JQUERY UI Dialog
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 });
}
});
精彩评论