我不确定Tumblr是否能做到这一点。我的弹出式不是“fancybox”。我试过在这里找到解决办法,但运气不太好。我有一个弹出框,当访客来到我的博客时会显示出来,但是每当我点击下一页时,它就会再次弹出。我不希望每次有人刷新的时候都会弹出来。我想要它,所以它每7天弹出一次每个用户,它有一个‘不要再次显示消息’的选项。
这是剧本。
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js"> </script>
<script>
$(document).ready(function() {
var id = '#dialog';
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
$('#mask').show(1000);
$('#mask').fadeTo("slow",0.5);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
//transition effect
$(id).show(2000);
//if close button is clicked
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
//if mask is clicked
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
});
</script>
这是关闭按钮
<a href="#" title="close" class="close"><div class="rotating" style="margin- left:395px; margin-top:-25px; position:absolute;"><big>✦</big> </div></a><br><br>
发布于 2016-06-21 16:56:13
您将不得不使用cookie或会话在您的网站上,以便您可以跟踪哪些用户看到弹出。
在这种情况下,我可能会推荐HTML5 webstorage。
然后,您可以使用过期日期存储与弹出窗口相关的项目,在向用户显示弹出窗口之前,您可以每次检查或设置该日期。
希望这能有所帮助。
https://stackoverflow.com/questions/37956846
复制