jq 自定义动画animate

这篇博客介绍了如何使用jQuery的animate方法创建自定义动画效果。通过示例展示了当鼠标悬停在两个不同元素上时,如何改变元素的宽高、位置,并运用缓动函数和回调函数实现复杂的动画序列。
摘要由CSDN通过智能技术生成

点击打开链接

<style>
            .box1{
                width: 200px;
                height: 200px;
                background: deeppink;
            }
            .box2{
                width: 200px;
                height: 200px;
                background: chartreuse;
                position: absolute;
                left: 0;
                top: 0;
            }
        </style>
    </head>
    <body>
        <div class="box1"></div>
        <div class="box2"></div>
    </body>
    <script src="js/js/jquery-1.12.4.min.js"></script>
    <script src="js/js/jquery.easing.1.3.js"></script>
    <script >
        $('.box1').on('mouseover',function(){
            $(this).animate({width:400,height:400},'slow','easeInOutBack',function()
            {
            console.log('我是回调函数');
        });
        });
        
        $('.box2').on('mouseover',function(){
            $(this).animate({left:500},'slow',function(){
                $(this).animate({top:500},'slow',function(){
                    $(this).animate({left:0},20000,function(){
                        $(this).animate({top:0},'slow');
                    });
                });
            });
        });

    </script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值