Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using the Zurb jQuery Modal script to bring up a popup box. when the user clicks the "close" x, I want to set a cookie so they don't see the popup again for 15 days.

For some reason, I can't get this to work, can someone help?

here is the live example: http://www.realcartips.com/test/modal/demo.html

And here is the jQuery code I'm using:

$(document).ready(function() {

if (!(jQuery.cookie("rct"))) {  

    setTimeout(function(){
    $('#myModal').reveal();
    }, 1000);

}
});

$(".close-reveal-modal").click(function () {
    $.cookie("rct", 1, { expires: 15, path: '/' });
});   

</script>

Edit: I forgot to mention I'm using the cookie jQuery plugin

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
169 views
Welcome To Ask or Share your Answers For Others

1 Answer

try this:

$(".close-reveal-modal").live("click",function () {
    alert("fired");
    $.cookie("rct", 1, { expires: 15, path: '/' });
}); 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...