基本动画运用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #box{
            width: 150px;
            height: 150px;
            background: blue;
            display: none;
        }
    </style>
</head>
<body>
    <button id="showBtn">show</button>
    <button id="hideBtn">hide</button>
    <div id="box"></div>
    <script src="lib/jquery-2.2.2.js"></script>
    <script>
        /*
          show() 无动画版
          hide()
        */
        $('#showBtn').click(function(){
            // $('#box').show();
            // $('#box').show('slow');
            $('#box').show(1000,function(){
                alert('over');
            });

        });
        $('#hideBtn').click(function(){
            $('#box').hide(6000);
        });
    </script>
    
</body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_44606660/article/details/88355099