登录我们的网上银行产品以显示消息时,我们有一个JQuery UI模式对话框。每次弹出这个。现在我们想要使这个基于cookie,因此用户只能看到此框一次,直到他们的cookie被清除。我怎样才能做到这一点?
<body onLoad="loadPage();" onUnload="unloadPage();">
<script>
$(function() {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
//$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-modal" ).dialog({
height: 475,
width: 550,
position: 'top',
modal: true,
buttons:{ "Close": function() { $(this).dialog("close"); } },
draggable: false,
resizable: false
});
});
</script>
答案 0 :(得分:1)
答案 1 :(得分:0)
单击关闭按钮时,将存储cookie as(Cookie name = subscribe_popup_status)值(显示)
$ .cookie(&#34; cookie_name&#34;,&#34; cookie_value&#34;);
$( '.home_page_popup' ).dialog({
autoOpen: false,
closeText: "",
modal: true,
resizable: false,
icon: "ui-icon-heart",
classes: {
"ui-dialog": "home_page_popup_dialog"
},
width: pop_up_width
});
$(".home_page_popup").on("click",".popup_close",function() {
if ($.cookie('subscribe_popup_status') == null) {
$.cookie('subscribe_popup_status', 'shown',{ expires: popup_duration });
}
$( '.home_page_popup' ).dialog('close');
});