一个不错的对联广告的效果

来源:互联网 发布:淘宝nba旗舰店 编辑:程序博客网 时间:2020/11/27 13:10

 

<style type="text/css">
<!--
@import url("css/yangshi.css");
-->
.floatad {
        position:absolute;
        width:100px;
        height:400px;
        top:283px;
        margin-top:-200px;
        background:url(images/duilian.jpg);
}
#float1 {
        left:20px;
}
#float2 {
        right:14px;
}

</style>

</head>

<body >

<div id="float1" class="floatad"><a href="javascript:FloatDiv.Close('float1','float2');">×</a></div>
<div id="float2" class="floatad"><a href="javascript:FloatDiv.Close('float1','float2');">×</a></div>
<script>
var FloatDiv = {
        Float : function (){
                var xtop = document.documentElement.scrollTop || document.body.scrollTop;
                for(var i = 0; i < arguments.length; i ++){
                        var _float = document.getElementById(arguments[i]);
                        _float.style.top = "50%";
                        _float.style.marginTop = parseFloat(xtop) - parseFloat(_float.clientHeight) / 2 + "px";
                }
        },
        Close : function (){
                for(var i = 0; i < arguments.length; i ++){
                        var _float = document.getElementById(arguments[i]);
                        _float.style.display = "none";
                }
        }
};
window.onscroll = function () {FloatDiv.Float("float1", "float2");}
</script>

 

原创粉丝点击