本文实例讲述了jquery实现可关闭的倒计时广告特效代码。分享给大家供大家参考。具体如下:
这是一款类似播放视频时候最开始的倒计时广告,广告时间结束才能看到视频内容,一个射流研究…小贴片广告代码,右上角带关闭按钮,左上角显示倒计时剩余时间,运行jQuery代码综合实现,CSS和超文本标记语言共同结合的网页特效,兼容各主流浏览器,本效果是从门户网站上整理而来。希望大家喜欢。
先来看看运行效果截图:
在线演示地址如下:
http://演示。JB 51。net/js/2015/jquery-关闭时间-adv-style-codes/
具体代码如下:
!DOCTYPE html html html healtheeta charset=' GB 2312 ' title js贴片倒计时代码/title style * { padd :0;margin :0 font-size :12 px;}ol,ul,Li {列表式:无} img {边框:无} .盒子{ width :564 pxh8 :361 pxmargin 336020 px汽车;位置:相对;display:none}。ad _ time { width :554 pxh three :351 px背景技术: # 000;filter:alpha(不透明度=50);-moz-opa市33600.5;opa city 3360 0.5 padding :5 px位置:绝对;top :0 left :0 color : # fff }。ad _ time span { font-weight : bold;color : # cc 0 padd :0 5px }。关闭{宽度:49像素高度:20 px背景: URL(图片/关闭。巴布亚新几内亚)不重复;位置:绝对;top :0 right :0光标:指针指针;}.btn { width:100px高度:30 px背景技术# eeeborder:1px实心# dddfont:normal 12px/30px '寰蒋闆呴粦;文本对齐:居中;余量:20px汽车;光标:指针指针;}/style脚本类型=' text/JavaScript ' src=' http : jquery-1。6 .2 .量滴js ' language=' JAVAScript '/script script type=' text/JAVAScript ' language=' JAVAScript '函数lxfEndtime(){ $ t=$(' # t ').html();if($t!=0){ $('#t ').html($ t-1);$i=setTimeout('lxfEndtime()',1000);}else{ $(' .方框')。hide();$('.BTN ' .show();$('#t ').html(6);$('.ad _ time’).css({'width':'554px ',' height ' : ' 351 px ' });清除超时(1美元);}};$(文档)。ready(function(){ $(')).BTN ' .live('click ',function(){ $(').方框')。show();$(这个)。hide();$('.ad _ time’).动画({width:110,height:18},' slow ');lxfEndtime();}) $('.关闭')。单击(函数(){ $(').方框')。hide();$('.BTN ' .show();$('#t ').html(6);$('.ad _ time’).css({'width':'554px ',' height ' : ' 351 px ' });清除超时(1美元);})});/剧本/床头柜!-代码开始-div class=' box ' div class=' ad ' a href=' # ' target=' _ blank ' img src=' http : images/ad。jpg '/a/div class=' ad _ time '时间还剩跨度id=t ' 50/跨度秒/div class=' close '/div/div class=' BTN '点击显示效果/div!-代码结束- /body/html希望本文所述对大家的jquery程序设计有所帮助。