0

无法设置我的 cookie。一旦用户单击关闭,我希望设置一个 cookie。如果用户已经关闭灯箱,我想编写脚本以不提示用户。我在用着:

github 上的 jquery UI jQuery Cookie 库

http://jsfiddle.net/5mDja/72/

<script>    
    $(function Modal_Stuff() {
var myPos = {
    my: "center",
    at: "left bottom",
    of: window
};

var myButton = {
Close: function(){$(this).dialog('close'); $.cookie('showDialog', 'false', { expires: 3650 });  }  

};

if ($.cookie('showDialog') == undefined || $.cookie('showDialog') == null || $.cookie('showDialog') != 'false') {
$("#dialog-modal").dialog({
    width: 350,
    autoOpen: true,
    autoResize: true,
    modal: false,
    resizable: false,
    draggable: false,
    show: 'slide',
    buttons: myButton,
    position: myPos


});

};

});



</script>


</head>
<title>jQuery UI Dialog - Basic modal</title>
<body>
    <div id="dialog-modal" title="Need a Hospice Solution?">
        <p>Get a demo now!</p>
        <form>First Name
            <input>
           <br/>Last Name
            <input>
            <br/>Email
            <input>
            <br/>Company
            <input>
            <br/>
        </form>
    </div>
    <p>Sed vel diam id libero <a href="http://example.com">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.</p>
</body>
4

0 回答 0