jq基础-淡入淡出动画

195 阅读1分钟
        div {
            display: none;
            width: 200px;
            height: 200px;
            background: red;
            border-radius: 50%;
        }    
    </style>
</head>

<body>
    <div></div>
    <button class="a">动起来</button>
    <script src="./jquery-1.12.4.js"></script>
    
        /* fadeIn()和fadeOut()可以通过改变元素的透明度实现淡入淡出效果 */
        // $('.a').click(function () {
        //     fadeIn()
        // })
        // function fadeIn() {
        //     /* fast normal slow  */
        //     $('div').fadeIn(200,fadeOut)
        // }
        // function fadeOut() {
        //     $('div').fadeOut(0, fadeIn)
        // }

    </script>