Skip to content

Instantly share code, notes, and snippets.

@bjrnqprs
Created November 15, 2013 10:13
Show Gist options
  • Save bjrnqprs/7482118 to your computer and use it in GitHub Desktop.
Save bjrnqprs/7482118 to your computer and use it in GitHub Desktop.
Open a popup window in the center of the screen
/**
* 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