jquery动画滑入滑出

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title></title>

        <script src="jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>

        <script type="text/javascript">
            // 入口函数
            $(document).ready(function() {
                var jqDown = $("#down");
                var jqUp = $("#up");
                var jqToggle = $("#toggle");
                var jqDiv = $("div");

                jqDown.click(function() {
                    jqDiv.slideDown();
                })

                jqUp.click(function() {
                    jqDiv.slideUp();
                })

                jqToggle.click(function() {
                    jqDiv.slideToggle(2000);
                })
            });
        </script>

        <style type="text/css">
            div {
                height: 100px;
                width: 100px;
                background-color: aqua;
                margin: 10px;
            }
        </style>
    </head>
    <body>
        <input type="button" name="" id="down" value="滑入" />
        <input type="button" name="" id="up" value="滑出" />
        <input type="button" name="" id="toggle" value="切换" />

        <div id="">

        </div>
    </body>
</html>

(0)

相关推荐