Created
July 21, 2015 03:56
-
-
Save linhyo/8b0b380d4faba87f79b9 to your computer and use it in GitHub Desktop.
Center Twitter login popup window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://www.codeofaninja.com/2011/04/how-to-center-screen-pop-up-window-with.html | |
function showcontactusform() { | |
//set the width and height of the | |
//pop up window in pixels | |
var width = 500; | |
var height = 500; | |
//Get the TOP coordinate by | |
//getting the 50% of the screen height minus | |
//the 50% of the pop up window height | |
var top = parseInt((screen.availHeight/2) - (height/2)); | |
//Get the LEFT coordinate by | |
//getting the 50% of the screen width minus | |
//the 50% of the pop up window width | |
var left = parseInt((screen.availWidth/2) - (width/2)); | |
//Open the window with the | |
//file to show on the pop up window | |
//title of the pop up | |
//and other parameter where we will use the | |
//values of the variables above | |
window.open('contact_form.php', | |
"Contact The Code Ninja", | |
"menubar=no,resizable=no,width=500,height=500,scrollbars=yes,left=" | |
+ left + ",top=" + top + ",screenX=" + left + ",screenY=" + top); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment