jQuery实现右下角弹出广告

JS or jQuery, 转自点点 11 年前 回复

, ,

几行代码即可实现右下角弹出广告;

JS代码如下:

<script type="text/javascript">
        $(document).ready(function(){
            setTimeout(function(){
                $("#ad").slideDown();
            },1000)
            $("#close").click(function(){
                $("#ad").slideUp();
            })
        })
    </script>

html代码:

< !DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<title>无标题文档</title>
</head>
    
<style>
    *{ margin:0px; padding:0px;}
    #ad{ width:300px; height:200px; border:1px solid #000; position:absolute; bottom:0px; right:10px; display:none;}
    #ad a{ position:absolute; top:8px; right:8px; font-size:12px; text-decoration:none;}
    #ad h2{ font-size:24px; text-align:center; line-height:200px; font-family:"微软雅黑";}
</style>
<body>
    <div id="ad">
        <a href="javaScript:void(0)" id="close">关闭</a>
        <h2>前端开发窝</h2>
    </div>
</body>
</html>
支付宝打赏微信打赏

如果此文对你有帮助,欢迎打赏作者。

发表评论

欢迎回来 (打开)

(必填)