wordpress - Close Cookied jQuery UI Dialog With a Link -
i'm having trouble getting dialog respond how want. first script works fine not use cookies prevent dialog showing returning visitors. #closedb anchor says "i'm not interested" , closes dialog.
jquery(document).ready(function($) { $("#email").dialog ({ autoopen: true, modal:true, width:400, }); }); jquery(document).ready(function ($) { $("#closedb").click(function () { $("#email").dialog('close'); }); });
this block has cookie check anchor not close dialog in example.
jquery(document).ready(function($) { if (document.cookie.indexof('visited=true') == -1) { var fifteendays = 1000*60*60*24*15; var expires = new date((new date()).valueof() + fifteendays); document.cookie = "visited=true;expires=" + expires.toutcstring(); $("#email").dialog ({ autoopen: true, modal:true, width:400, }); } }); jquery(document).ready(function ($) { $("#closedb").click(function () { $("#email").dialog('close'); }); });
here markup.
<div id="email" style="color: #333; display: none;" title="title"> <p>copy goes here</p> <form> <input type="text" /> <input type="text" /> <input type="email" /> <input type="submit" /> <a id="closedb" href="#">close</a> </form> </div>
thanks can lend.
Comments
Post a Comment