Created
March 16, 2014 07:18
-
-
Save LinuxPhreak/9579648 to your computer and use it in GitHub Desktop.
Modal Wont Close
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
$(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