开发者

JQuery popup works on load, but then reloads

开发者 https://www.devze.com 2023-04-05 05:11 出处:网络
I am trying to make a simple popup without extensions to jquery. The popup load on page load like it should, but the problem I am having is making some way to close the popup without it automatically

I am trying to make a simple popup without extensions to jquery. The popup load on page load like it should, but the problem I am having is making some way to close the popup without it automatically re-initating when I do so.Which it currently does, because it is attached to $(document).ready(. Thanks :)

 $(document).ready(function(){
     $('#page').animate({"opacity":"0.4"});
 $('#popup').delay(300开发者_运维百科).fadeIn('slow');

$('#close').click( function() {
    $('#page').animate({"opacity":"1"});
 $('#popup').fadeOut('fast');
})
})


If #close is a link with href, you may try this:

 $('#close').click( function(event) {
     event.preventDefault();
     $('#page').animate({"opacity":"1"});
     $('#popup').fadeOut('fast');
 });
0

精彩评论

暂无评论...
验证码 换一张
取 消