[英]Multi style sheet with jQuery cookies (Issue with pop up box)
$(function() {
$('#yes a').click(function() {
$.cookie('AutoPlayTrue', '1', {
expires: 999
});
$('.disableAutoPlay').hide('slow');
$.cookie('ccss_remembered_style', null);
$.cookie('AutoPlayFalse', null);
});
$('#ccss-no a').click(function() {
$.cookie('AutoPlayFalse', '1', {
expires: 999
});
$('.disableAutoPlay').hide('slow');
$.cookie('AutoPlayTrue', null);
});
if ($.cookie('AutoPlayFalse') === null) {
$('.disableAutoPlay').show();
}
else {
$('.disableAutoPlay').hide();
}
if ($.cookie('AutoPlayTrue') === null) {
$('.disableAutoPlay').show();
}
else {
$('.disableAutoPlay').hide();
}
});
I have a pop up box with the HTML: 我有一个带有HTML的弹出框:
<li class="widget ccss" id="ccss-widget-3"><h2 class="widgettitle">Should HipHop97.com Automatically Start Playing Music?</h2>
<ul id="ccss-list">
<li id="ccss-no"><a href="http://hiphop97.com/wp-content/themes/hiphop/noAutoPlayCSS.css">No</a></li><li id="yes"><a href="#">Yes</a></li>
</ul>
</li>
I need when the 'yes' button is selected just act as a 'close' and with cookies 'don't show me again' and the 'no' button I've already got the style sheet and stuff code worked out I just need it to not display the box again with cookies. 我需要当选择'是'按钮时只是作为'关闭'并且使用cookies'不再显示我'和'否'按钮我已经得到了样式表和填写的代码我只需要它不会再次显示带有cookie的盒子。 (The element is in the theme, just marked as display:none;
it's at the top of the main container.) (元素在主题中,只标记为display:none;
它位于主容器的顶部。)
I tried this, it's a good concept I suppose, it just doesn't work: 我试过这个,这是一个很好的概念我认为,它只是不起作用:
<script type="text/javascript">
jQuery(document).ready(function($) {
if ($.cookie('AutoPlayFalse')) {
$('.displayAutoPlay').css('display','none !important');
}
if ($.cookie('AutoPlayTrue')) {
$('.displayAutoPlay').css('display','none !important');
}
});
</script>
if(!$.cookie('autoplay')){
//display box
}else{
$.cookie('autoplay',1);
}
I dont understand why do you over complicate it as much :) 我不明白为什么你这么复杂:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.