Last active
August 29, 2015 14:04
-
-
Save thotbox/a9f150a8f63bc86e688f to your computer and use it in GitHub Desktop.
JavaScript: Popup Confirm Close
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
// Vote Submit | |
function voteShare (pageURL,title,w,h) { | |
var left = (window.screen.width/2)-(w/2); | |
var top = (window.screen.height/2)-(h/2); | |
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); | |
var pollTimer = window.setInterval(function() { | |
if (targetWin.closed !== false) { | |
window.clearInterval(pollTimer); | |
setTimeout(function () { | |
$('#vote').submit(); | |
}, 1000); | |
} | |
}, 200); | |
} | |
$('#vote-submit').click(function() { | |
event.preventDefault(); | |
var shareLink = $(this).attr('data-link'); | |
voteShare(shareLink, 'Share',700,400); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment