[英]Pop-up ' Don't show this message again ' option
I'm not sure if this will be possible on Tumblr . 我不确定Tumblr上是否有可能。 The popup I have isn't a ' fancybox' .
我的弹出窗口不是'fancybox'。 I've tried finding a solution here but I haven't had much luck .
我曾尝试在这里找到解决方案,但运气不佳。 I have a pop-up box that is displayed when a visitor comes to my blog , but whenever I click the next page -- it pops up again .
当访问者访问我的博客时,我会显示一个弹出框,但是每当我单击下一页时,它就会再次弹出。 I do not want it popping up every time someone refreshes .
我不希望每次有人刷新时弹出它。 I want it so it pops once every 7 days per user and it has a ' do not display message again ' option for them.
我想要它,因此每位用户每7天弹出一次,并且有一个“不再显示消息”选项。
This is the script. 这是脚本。
<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>
This is the close button 这是关闭按钮
<a href="#" title="close" class="close"><div class="rotating" style="margin- left:395px; margin-top:-25px; position:absolute;"><big>✦</big> </div></a><br><br>
You will have to use cookies or sessions on your website so that you can track which users have seen pop-ups. 您将必须在网站上使用cookie或会话,以便可以跟踪哪些用户看到了弹出窗口。
In this case I would probably recommend HTML5 webstorage. 在这种情况下,我可能会推荐HTML5网络存储。
You can then store an item relating to your popup with an expiry date that you can check or set every time before showing a user a popup. 然后,您可以存储与您的弹出窗口相关的项目,并在向用户显示弹出窗口之前每次检查或设置一个到期日期。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.