jQuery 动画 animate

jQuery 动画 animate

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>jQuery</title>
    <script src="jquery-3.3.1.min.js"></script>
</head>
<body>
    <script type="text/javascript">
    $(function(){
        // 按钮单击时执行
    $("#btnInfo1").click(function(){
            var div = $("#div1");
            div.animate({height:'200px', opacity:'0.4'}, "slow");
            div.animate({width:'200px', opacity:'0.8'}, "slow");
            div.animate({height:'100px', opacity:'0.4'}, "slow");
            div.animate({width:'100px', opacity:'0.8'}, "slow");
        });
    })

    </script>
  <button id="btnInfo1" type="button">动画</button>
    <div id="div1" style="background:#000000;height:100px;width:100px;position:absolute;"></div><br>
  
</body>
</html>

 

发表回复

您的电子邮箱地址不会被公开。