拉幅广告代码

<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>拉幅广告</title>
</head>

<body>



<script src="http://www.hc360.com/dx/zl/2016/1121/js/jquery-1.10.2.min.js"></script>


<!--拉幕广告-->
<style type="text/css">
/* advbox */
*html,*html body{background-image:url(about:blank);background-attachment:fixed;}
*html .advbox{position:absolute;top:expression(eval(document.documentElement.scrollTop));}
.advbox{width:1190px;position:fixed;display:none;left:50%;top:0;margin:-200px 0 0 -595px;}
.advbox .advpic{position:relative;height:450px;overflow:hidden;}
.advbox .advpic .closebtn{display:block;width:60px;height:26px;line-height:26px;font-size:12px;color:#fff; text-align:center;overflow:hidden;position:absolute;right:8px;top:5px;z-index:99; cursor:pointer; background:#000;opacity:0.8; filter:alpha(opacity=80);-moz-opacity:0.8;}
.advbox .advpic .ad_time{display:block;width:180px;height:26px;line-height:26px;font-size:12px;color:#fff; text-align:center;overflow:hidden;position:absolute;left:8px;top:5px;z-index:99; cursor:pointer; background:#000;opacity:0.8; filter:alpha(opacity=80);-moz-opacity:0.8;}
.advbox .advpic .ad_time strong{
        width: 20px;
        display: inline-block;
        text-align: center;
        font-family: georgia;
        color: #fff;
    }
</style>
<div class="advbox">
    <div class="advpic">
        <a href="http://info.machine.hc360.com/zt/zzwl/index.shtml" target="_blank"><img width="1190" height="450" src="http://www.hc360.com/dx/images/gg1.png"/></a>
        <div href="javascript:void(0);" class="closebtn">关闭</div>
       <div class="ad_time"> 广告时间还剩<strong class="a">10</strong><strong class="b"></strong>毫秒</div>
    </div>    
</div>
<script type="text/javascript">
    $(document).ready(function() {
        var times = 5 * 100; // 60秒
        countTime = setInterval(function() {
            times = --times < 0 ? 0 : times;
            var ms = Math.floor(times / 100).toString();

            if(ms.length <= 1) {
                ms = "0" + ms;
            }
            var hm = Math.floor(times % 100).toString();
            if(hm.length <= 1) {
                hm = "0" + hm;
            }
            if(times == 0) {
                $(".advbox").fadeOut(500);
                clearInterval(countTime);
            }
            // 获取分钟、毫秒数
            $(".a").html(ms);
            $(".b").html(hm);
        }, 10);
    });
</script>

<script type="text/javascript">
$(document).ready(function(){

    $(".advbox").show();
    $(".advbox").animate({top:"50%"},800);
    
    $(".closebtn").click(function(){
        $(".advbox").fadeOut(500);
    })
})
</script>






</body>
</html>
原文地址:https://www.cnblogs.com/su1637/p/8259241.html