html5 右下角弹出 广告框

时间:2021-09-01 20:17:47
<!DOCTYPE html>
<html>


<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .ad {
            position: fixed;
            right: 0;
            bottom: 0;
            width: 230px;
            height: 120px;
            background-image: url(imgs/ad.jpg);
            display: none;
        }


        .ad span {
            position: absolute;
            right: 0;
            top: 0;
            width: 40px;
            height: 18px;
            background-image: url(imgs/h.jpg);
            cursor: pointer;
        }
    </style>
    <script src="../jquery-1.11.1.js"></script>
    <script>
        $(function () {
            //需求:然广告ad部分,先滑入,在滑出,在淡入。然后绑定事件,点击span弹出
            //步骤:
            $(".ad").slideDown(1000).slideUp(1000).fadeIn(1000).children("span").click(function () {
                $(this).parent().fadeOut(1000);
            });


            $(".ad").slideDown(1000, function () {
                $(".ad").slideUp(1000, function () {
                    $(".ad").fadeIn(1000, function () {
                        $(".ad").children("span").click(function () {
                            $(this).parent().fadeOut(1000, function () {
                                alert("执行完毕!");
                            });
                        });
                    });
                });
            })
        })
    </script>
</head>


<body>


    <div class="ani">我是内容</div>
    <div class="ad">
        <span></span>
    </div>




</body>
</html>