jQuery animate

本文介绍了一个简单的网页示例,通过使用jQuery库来实现HTML页面中div元素的放大和还原动画效果。此外,还展示了如何通过点击按钮触发不同的动画,并在动画完成后更新提示信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <script src="js/jquery-3.2.1.min.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript">
            $(function(){
                $("#btn1").click(function(){
                    $("#tip").text("")
                    $("#box").animate({"height":"200px","width":"200px","left":"100px","top":"100px"},2000,function(){
                        $("#tip").text("放大动画完成")
                    });
                    
                })
                $("#btn2").click(function(){
                    $("#tip").text()
                    $("#box").animate({"height":"100px","width":"100px","left":"0px","top":"0px"},2000,function(){
                        $("#tip").text("还原动画完成")
                    })
                })
                $("#closead").click(function(){
                    $("#ad").animate({"bottom":"-200x"})
                })
            })
        </script>
    </head>
    <body style="margin: 0px;padding: 0px;">
    <button id="btn1">放大</button>
    <button id="btn2">还原</button>
    <div id="box" style="background: #4087f1; height: 100px; width: 100px; position: relative;"></div>
    <div id="tip"></div>
    <div id="ad" style="background-color: dodgerblue; color: wheat; position: fixed; bottom: 0px; width: 100%;"><div id="closead" style="text-align: right;color: #81aff5; cursor: pointer;">x</div>
    <div >
        中华人民共和国
    </div>
    </div>
    
    </body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值