Created
January 19, 2012 14:37
-
-
Save tsyber1an/1640355 to your computer and use it in GitHub Desktop.
popup centered nested window in html
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
function popupCenter(url, width, height, name) { | |
var left = (screen.width/2)-(width/2); | |
var top = (screen.height/2)-(height/2); | |
return window.open(url, name, "menubar=no,toolbar=no,status=no,width="+width+",height="+height+",toolbar=no,resizable=yes,scrollbars=yes,left="+left+",top="+top); | |
}; | |
/* Usage by example */ | |
jQuery('.auth_form').submit(function(e){ | |
var $form = jQuery(this); | |
var social = $form.find('input[name=social]:checked'); | |
if( social.length > 0 ) | |
{ | |
var _href = '/users/auth/' + social.val(); | |
popupCenter(_href, 640, 480, "authPopup"); | |
e.stopPropagation(); | |
return false; | |
} | |
return true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment