以下是 可关闭重复播放下拉js代码 的示例演示效果:
部分效果截图:
HTML代码(index.html):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content=" " />
<meta name="description" content=" " />
<title>可关闭及重复播放泰山压顶广告</title>
<link rel=stylesheet type=text/css href="css/lrtk.css">
</head>
<body style="text-align:center">
<br><br>
<div class="gg_full wrapfix">
<div class=gg_fbtn><A style="DISPLAY: none" class=gg_freplay title=重播
href="#"></A><A class=gg_fclose title=关闭
href="#"></A></div>
<div class=gg_fcon></div></div>
<script type=text/javascript src="js/jquery-1.4.2.min.js"></script>
<script type=text/javascript src="js/qpxl.js"></script>
</body>
</html>
JS代码(qpxl.js):
//首页大广告var gg960ShowTime = 10000;
//播放时间var gg960Time = null;
function open_gg960(showBtn){
$('.gg_full .gg_fcon').html(gg960Con).slideDown(300,function(){
if(showBtn !== false){
$('.gg_full .gg_fbtn').fadeIn();
}
if(gg960Time){
clearTimeout(gg960Time);
}
gg960Time = setTimeout(close_gg960,gg960ShowTime);
}
);
}
function close_gg960(){
$('.gg_full .gg_fcon').slideUp(500,function(){
$(this).html('');
$('.gg_fclose').hide();
$('.gg_freplay').show();
}
);
}
$('.gg_fclose').click(function(){
if(gg960Time){
clearTimeout(gg960Time);
}
close_gg960();
return false;
}
);
$('.gg_freplay').click(function(){
if(gg960Time){
clearTimeout(gg960Time);
}
open_gg960(false);
$('.gg_freplay').hide();
$('.gg_fclose').show();
return false;
}
);
var gg960Con;
var fullAdType = 'swf';
var fullAdUrl = '/'var fullAdName = 'images/qpad.swf';
;
if(fullAdName){
if(fullAdType == 'swf'){
gg960Con = '<embed wmode="transparent" height="400" width="980" flashvars="alink1='+fullAdUrl+'" allowscriptaccess="always" quality="high" name="Advertisement" id="Advertisement" style="" src="images/qpad.swf" type="application/x-shockwave-flash"></embed>';
}
else{
gg960Con = '<a href="'+fullAdUrl+'" target="_blank"><img width="980" height="400" src="images/qpad.jpg"/></a>';
//flash无法显示时,显示JPG广告}
setTimeout(open_gg960,1500);
//延迟显示}
CSS代码(lrtk.css):
fieldset,img{border:0 none;}
:focus{outline:0;}
:link,:visited,ins{text-decoration:none;}
body{min-width:1000px;font:12px/1.5 tahoma,sans-serif;}
body{text-align:center;margin:0px;}
a{text-decoration:none;color:#333;}
a:hover{text-decoration:underline!important;color:#FF6600!important;}
.gg_full{POSITION:relative;MARGIN:0px auto;WIDTH:980px;background:#FFFFFF}
.gg_full .gg_fbtn{POSITION:absolute;WIDTH:19px;DISPLAY:none;HEIGHT:55px;TOP:10px;right:-23px}
.gg_full .gg_fbtn A{DISPLAY:block;BACKGROUND:url(../images/gg_btn.png) no-repeat 0px 0px;HEIGHT:55px;OVERFLOW:hidden}
.gg_full .gg_fbtn .gg_fclose{BACKGROUND:url(../images/gg_btn.png) no-repeat -19px 0px}
.gg_full .gg_fcon{DISPLAY:none;HEIGHT:400px;}