jquery实现可关闭的倒计时广告特效代码
作者:bea
本文实例讲述了jquery实现可关闭的倒计时广告特效代码。分享给大家供大家参考。具体如下: 这是一款类似播放视频时候最开始的倒计时广告,广告时间结束才能看到视频内容,一个JS小贴片广告代码,右上角带关闭按钮,左上角显示倒计时剩余时间,运行jQuery代码综合实现,CSS和HTML共同结合的网页特效,兼容各主流浏览器,本效果是从门户网站上整理而来。希望大家喜欢。 先来看看运行效果截图: 在线演示地址如下: http://demo./js/2015/jquery-close-t
本文实例讲述了jquery实现可关闭的倒计时广告特效代码。分享给大家供大家参考。具体如下:
这是一款类似播放视频时候最开始的倒计时广告,广告时间结束才能看到视频内容,一个JS小贴片广告代码,右上角带关闭按钮,左上角显示倒计时剩余时间,运行jQuery代码综合实现,CSS和HTML共同结合的网页特效,兼容各主流浏览器,本效果是从门户网站上整理而来。希望大家喜欢。
先来看看运行效果截图:
在线演示地址如下:
http://demo./js/2015/jquery-close-time-adv-style-codes/
具体代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<title>js贴片倒计时代码</title>
<style>
*{padding:0;margin:0; font-size:12px;}
ol,ul,li{list-style:none}
img{border:none}
.box{ width:564px; height:361px; margin:20px auto; position:relative; display:none;}
.ad_time{ width:554px; height:351px; background:#000; filter:alpha(opacity=50);-moz-opacity:0.5;opacity: 0.5; padding:5px; position:absolute; top:0; left:0; color:#fff;}
.ad_time span{ font-weight:bold; color:#cc0; padding:0 5px;}
.close{ width:49px; height:20px; background:url(images/close.png) no-repeat; position:absolute; top:0; right:0; cursor:pointer;}
.btn{ width:100px; height:30px; background:#eee; border:1px solid #ddd; font:normal 12px/30px '寰蒋闆呴粦'; text-align:center; margin:20px auto; cursor:pointer;}
</style>
<script type="text/javascript" src="jquery-1.6.2.min.js" language="javascript"></script>
<script type="text/javascript" language="javascript">
function lxfEndtime(){
$t=$('#t').html();
if($t!=0){
$('#t').html($t-1);
$i=setTimeout("lxfEndtime()",1000);
}else{
$('.box').hide();
$('.btn').show();
$('#t').html(6);
$('.ad_time').css({'width':'554px','height':'351px'});
clearTimeout($i);
}
};
$(document).ready(function(){
$('.btn').live('click',function(){
$('.box').show();
$(this).hide();
$('.ad_time').animate({width:110,height:18},'slow');
lxfEndtime();
})
$('.close').click(function(){
$('.box').hide();
$('.btn').show();
$('#t').html(6);
$('.ad_time').css({'width':'554px','height':'351px'});
clearTimeout($i);
})
});
</script>
</head>
<body>
<!--代码开始-->
<div class="box">
<div class="ad"><a href="#" target="_blank"><img src="images/ad.jpg" /></a></div>
<div class="ad_time">时间还剩<span id="t">50</span>秒</div>
<div class="close"></div>
</div>
<div class="btn">点击显示效果</div>
<!--代码结束-->
</body>
</html>
希望本文所述对大家的jquery程序设计有所帮助。
有用 | 无用
这是一款类似播放视频时候最开始的倒计时广告,广告时间结束才能看到视频内容,一个JS小贴片广告代码,右上角带关闭按钮,左上角显示倒计时剩余时间,运行jQuery代码综合实现,CSS和HTML共同结合的网页特效,兼容各主流浏览器,本效果是从门户网站上整理而来。希望大家喜欢。
先来看看运行效果截图:
在线演示地址如下:
http://demo./js/2015/jquery-close-time-adv-style-codes/
具体代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<title>js贴片倒计时代码</title>
<style>
*{padding:0;margin:0; font-size:12px;}
ol,ul,li{list-style:none}
img{border:none}
.box{ width:564px; height:361px; margin:20px auto; position:relative; display:none;}
.ad_time{ width:554px; height:351px; background:#000; filter:alpha(opacity=50);-moz-opacity:0.5;opacity: 0.5; padding:5px; position:absolute; top:0; left:0; color:#fff;}
.ad_time span{ font-weight:bold; color:#cc0; padding:0 5px;}
.close{ width:49px; height:20px; background:url(images/close.png) no-repeat; position:absolute; top:0; right:0; cursor:pointer;}
.btn{ width:100px; height:30px; background:#eee; border:1px solid #ddd; font:normal 12px/30px '寰蒋闆呴粦'; text-align:center; margin:20px auto; cursor:pointer;}
</style>
<script type="text/javascript" src="jquery-1.6.2.min.js" language="javascript"></script>
<script type="text/javascript" language="javascript">
function lxfEndtime(){
$t=$('#t').html();
if($t!=0){
$('#t').html($t-1);
$i=setTimeout("lxfEndtime()",1000);
}else{
$('.box').hide();
$('.btn').show();
$('#t').html(6);
$('.ad_time').css({'width':'554px','height':'351px'});
clearTimeout($i);
}
};
$(document).ready(function(){
$('.btn').live('click',function(){
$('.box').show();
$(this).hide();
$('.ad_time').animate({width:110,height:18},'slow');
lxfEndtime();
})
$('.close').click(function(){
$('.box').hide();
$('.btn').show();
$('#t').html(6);
$('.ad_time').css({'width':'554px','height':'351px'});
clearTimeout($i);
})
});
</script>
</head>
<body>
<!--代码开始-->
<div class="box">
<div class="ad"><a href="#" target="_blank"><img src="images/ad.jpg" /></a></div>
<div class="ad_time">时间还剩<span id="t">50</span>秒</div>
<div class="close"></div>
</div>
<div class="btn">点击显示效果</div>
<!--代码结束-->
</body>
</html>
希望本文所述对大家的jquery程序设计有所帮助。
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- js制作带有遮罩弹出层实现登录注册表单特效代码分享
- js实现仿MSN带关闭功能的右下角弹窗代码
- js实现浮动在网页右侧的简洁QQ在线客服代码
- JS实现先显示大图后自动收起显示小图的广告代码
- JavaScript实现的多个图片广告交替显示效果代码
- 基于JS实现简单的样式切换效果代码
- JS实现横向拉伸动感伸缩菜单效果代码
- js实现简洁的滑动门菜单(选项卡)效果代码
- js实现随屏幕滚动的带缓冲效果的右下角广告代码
- jQuery实现带有上下控制按钮的简单多行滚屏效果代码
- JS右下角广告窗口代码(可收缩、展开及关闭)
- js实现网站最上边可关闭的浮动广告条代码
- jquery实现浮动在网页右下角的彩票开奖公告窗口代码
- jquery实现的Accordion折叠面板效果代码
- jQuery实现带延迟效果的滑动菜单代码
- jquery实现顶部向右伸缩的导航区域代码
- jquery实现的Banner广告收缩效果代码
- js实现拉幕效果的广告代码
- JS实现弹性漂浮效果的广告代码