jquery 的animate广告动画效果

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>广告动画</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .contant{
            min-width: 1200px;
            position: relative;
            height: 0px;
            /*height: 150px;*/
            /*height: 450px;*/
            border: 1px solid red;
            box-sizing: border-box;
            overflow: hidden;
            /*display: none;*/
        }
        .contant .contant-img{
            width: 100%;
        }
        .contant .contant-img .img-a{
            position: absolute;
            width: 100%;
            left: 0px;
            top: 0px;
            z-index: 0;
        }
        .contant .contant-img .img-b{
            position: absolute;
            width: 100%;
            left: 0px;
            top: 0px;
            z-index: -1;
        }
        .contant-close{
            font-size: 27px;
            color: aliceblue;
            position: absolute;
            top: 10px;
            right: 30px;
            z-index: 2;
            cursor: pointer;
        }

    </style>
</head>
<body>


<div class="contant">
    <div class="contant-img">
        <div class="img-a">
            <a href=""><img src="public/imgs/big-xmg.jpg" alt=""></a>
        </div>

        <div class="img-b">
            <a href=""><img src="public/imgs/small-xmg.jpg" alt=""></a>
        </div>
    </div>
    <div class="contant-close">x</div>
</div>





<!--js-->
<script src="public/jquery-1.12.4.min.js"></script>

<script>

    $(function () {

        //折叠动画
        $(".contant").animate({height:"450px"},3000).delay(1000)
            .animate({height:"150px"},1000,function () {
                $(this).find(".img-b").css("z-index","1");
            });

        //关闭
        $(".contant-close").click(function () {
            $(".contant").css({display:"none"})
        });

    });


</script>



</body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值