开发者

JQUERY UI Dialog

开发者 https://www.devze.com 2023-01-26 06:43 出处:网络
I want to open a j开发者_StackOverflowquery UI dialog once, automatically. This can be done by setting the autoOpen property to true. But i need that to happen only once. How should I do it.Since this

I want to open a j开发者_StackOverflowquery UI dialog once, automatically. This can be done by setting the autoOpen property to true. But i need that to happen only once. How should I do it.


Since this is across pageloads, I'd set a cookie (via the cookie plugin in this example), like this:

var seenBefore = $.cookie("dialogOnce") == "1";
$("#elem").dialog({
  autoOpen: !seenBefore,
  open: function() { 
    //we've seen it, don't show for 180 days
    $.cookie("dialogOnce", "1", { expires: 180 }); 
  }
});
0

精彩评论

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

关注公众号