1,Jquery提供的特效方法

2,实例代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"&gt;
    <meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    <title&gt;Document</title&gt;
</head>
<body>
    <img src="img2ee18-231100-163232346010b0.jpg" alt="" id="god" width="500px" height="400px">
    <div>
        <button id="show">显示</button>
        <button id="hide">隐藏</button>
        <button id="toggle">切换</button>
    </div>
    <p>淡入,淡出的测试</p>
    <img src="img2ee18-231100-163232346010b0.jpg" alt="" id="fadeText" width="500px" height="400px">
    <div>
        <button id="fadeIn">淡入</button>
        <button id="fadeOut">淡出</button>
        <button id="fadetoggle">淡入,淡出切换</button>
    </div>
    <script  src="js/jquery-3.1.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function(){
            // 显示隐藏动画效果
            $("#show").on("click",function(){
                $("#god").show();
            });

            $("#hide").on("click",function(){
                $("#god").hide(1000);
            });

            $("#toggle").on("click",function(){
                $("#god").toggle(1000,function(){
                    alert("在显示隐藏之间切换");
                });
            });

            //淡入,淡出
            $("#fadeIn").on("click",function(){
                $("#fadeText").fadeIn();
            });

            $("#fadeOut").on("click",function(){
                $("#fadeText").fadeOut(1000);
            });

            $("#fadetoggle").on("click",function(){
                $("#fadeText").fadeToggle(1000,function(){
                    alert("在显示隐藏之间切换");
                });
            });

        });
    </script> 
</body>
</html>

3,结果参考

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注