Created
November 15, 2013 10:13
-
-
Save bjrnqprs/7482118 to your computer and use it in GitHub Desktop.
Open a popup window in the center of the screen
This file contains hidden or 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
/** | |
* Opens a popup in the center of the screen | |
* | |
* @param url | |
* @param title | |
* @param width | |
* @param height | |
* @returns {window} | |
*/ | |
function openPopupCenter(url, title, width, height) { | |
var top = (screen.height/2)-(height/2); | |
var left = (screen.width/2)-(width/2); | |
return window.open( | |
url, title, | |
'width='+width+',height='+height+',top='+top+',left='+left+',resizable=yes' | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment