每3小时显示一次对话框

时间:2015-01-25 06:21:14

标签: javascript html css

在我的网站上工作,但希望每2-3小时只显示一次: - https://www.helpingtechie.com

这不是我的代码只是从给我的网站下载。

我认为需要添加Cookie。

使用的代码: -

.guestwarn-mask{
	position:absolute;
	background:#fff;
	opacity:0.5;
	filter:alpha(opacity=50);
	z-index: 4;
	overflow: hidden;
}
.guestwarn-layout{
	-moz-transform: scale(0);
	-webkit-transform: scale(0);
	-ms-transform: scale(0);
	-o-transform: scale(0);
	transform: scale(0);
	-webkit-transition: all 500ms cubic-bezier(0.39, 1.42, 0.48, 1) 250ms;
	-moz-transition: all 500ms cubic-bezier(0.39, 1.42, 0.48, 1) 250ms;
	-ms-transition: all 500ms cubic-bezier(0.39, 1.42, 0.48, 1) 250ms;
	-o-transition: all 500ms cubic-bezier(0.39, 1.42, 0.48, 1) 250ms;
	transition: all 500ms cubic-bezier(0.39, 1.42, 0.48, 1) 250ms;
	position:absolute;
	border:1px solid #eee;
	background:#fff;
	box-shadow: 1px 2px 4px rgba(100,100,100,0.1);
	display:none;
	z-index:5;
}
.guestwarn-layout-animate{
	-moz-transform: scale(1);
	-webkit-transform: scale(1);
	-ms-transform: scale(1);
	-o-transform: scale(1);
	transform: scale(1);
}
.guestwarn-layout-close{
	-webkit-transition: all 900ms cubic-bezier(.37,-0.99,.24,.24) 100ms;
	-moz-transition: all 900ms cubic-bezier(.37,-0.99,.24,.24) 100ms;
	-ms-transition: all 900ms cubic-bezier(.37,-0.99,.24,.24) 100ms;
	-o-transition: all 900ms cubic-bezier(.37,-0.99,.24,.24) 100ms;
	transition: all 900ms cubic-bezier(.37,-0.99,.24,.24) 100ms;
	top:-300px !important;
}
.guestwarn-content{
	position:relative;
	color:#555;
	overflow:hidden;
}
.guestwarn-title{
	position:absolute;
	left:0px;
	top:0px;
	height:40px;
	width:100%;
	overflow:hidden;
	background:#eee;
	font:normal 16px Microsoft Yahei;
	color:#fff
}
.guestwarn-title span{
	display:block;
	float:left;
	padding:10px 20px;
	background:#08c;
}
.guestwarn-close{
	position:absolute;
	right:0px;
	top:0px;
	background:#E04343;
	display:block;
	text-decoration:none;
	font-family:Tahoma;
	font-size:20px;
	line-height:37px;
	height:40px;
	width:40px;
	text-align:center;
	color:#fff
}
.guestwarn-close:hover{
	opacity:0.8;
	filter:alpha(opacity=80);
	}
.guestwarn-html{
	padding:50px 20px 20px 20px;
	font:normal 16px Microsoft Yahei;
	line-height: 150%;
	text-align:left;
}
.guestwarn-html a{
	color:#58f
}
<script src="https://www.helpingtechie.com/jscripts/jquery.guestwarn.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>

<script>
$(function(){
	$.guestwarn({
		mask:true,
		height: 'auto',
		title:'Dear Guest',
		html:'If you read this, it means you are not registered. <br><a href="/member.php?action=register" target="_blank">Click here</a> to register in a few simple steps, you will enjoy all features of our Forum.',
		callback:function(){
			console.log('CALLBACKS')
		}
	});
});
</script>

1 个答案:

答案 0 :(得分:0)

如果我理解你的问题&#34; corectly ...这可以帮助:

$(function(){
    setInterval(function() {
        $.guestwarn({
            mask:true,
            height: 'auto',
            title:'Dear Guest',
            html:'If you read this, it means you are not registered. <br><a href="/member.php?action=register" target="_blank">Click here</a> to register in a few simple steps, you will enjoy all features of our Forum.',
            callback:function(){
                console.log('CALLBACKS')
            }
        });
    }, 10800000);
// 10800000 is 3 hours in miliseconds
});