Skip to content

Instantly share code, notes, and snippets.

@LinuxPhreak
Created March 16, 2014 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LinuxPhreak/9579648 to your computer and use it in GitHub Desktop.
Save LinuxPhreak/9579648 to your computer and use it in GitHub Desktop.
Modal Wont Close
$(document).ready(function() {
$('a.gv-pop').click(function() {
// Getting the variable's value from a link
var loginBox = $(this).attr('href');
//Fade in the Popup and add close button
$(loginBox).fadeIn(300);
//Set the center alignment padding + border
var popMargTop = ($(loginBox).height() + 24) / 2;
var popMargLeft = ($(loginBox).width() + 24) / 2;
$(loginBox).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
// Add the mask to body
$('body').append('<div id="mask"></div>');
$('#mask').fadeIn(300);
return false;
});
// When clicking on the button close or the mask layer the modal should close but doesn't
$('a.close, #mask').live('click', function() {
$('#mask , .gvoice').fadeOut(300 , function() {
$('#mask').remove();
});
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment