我的pop只是在加载时自动隐藏,即使还没有设置cookie。我正在使用此Simple show/hide cookie,我的控制台没有显示任何错误。我要留下什么了吗?
<style>
.notice {
text-align: center;
background-color: #fff;
max-height: 100px;
left: 0px;
right: 0px;
color: #f5f5f5;
display: none;
z-index: 3008;
width: 380px;
}
#text1, #text2 {
position: relative;
}
</style>
<div id="barwrap" style="position:fixed;bottom:0;z-index:2;with:100%;height:100px;left:0;">
<div class="notice">
<div style="height: 40px; background-color: #f4a725;">
<div style="text-align:center;">
<h3 id="text1" style="padding-top: 6px;text-align:center;">Our Privacy Policy Has Changed. <a class="close" id="ok" href="#"><img style="width:20px; height: 20px;margin: 0 0 3px 15px;" src="/icon_privacy_exit.png"></a>
</h3></div>
</div>
<div id="text2" style="height: 45px; color: #777;padding:6px 0 6px 0;font-size: 17px;clear:both;">You agree to the <a href="/privacy">Privacy Policy</a>.</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script>
$(document).ready(function() {
if ($.cookie('notice') == 'closed') {
$('.notice').hide();
} else {
$('.notice').show();
}
// Show or hide on load depending on cookie
$('.notice #ok').click(function(e) {
e.preventDefault();
$.cookie('notice','closed');
$(this).parent().hide();
});
// close link to hide the notice until cookies are cleared
});
</script>
<script>
$(function(){setTimeout(function(){return
$(".notice").animate({height:"toggle"},"slow")},450);return
$("#ok").on("click",function(){
$("#barwrap").css("margin-bottom","0px");
$(".notice").animate({height:"toggle"},"slow");return!1})});
</script>