点击淡入 没有那种淡入的效果 麻烦大家看一下是哪里出问题了

recentlywe 2021-02-01 05:15:30


还想请教一下 如果只有两个框那
$(document).ready(function(){
$("button").click(function(){
$(".one").fadeIn();
$(".two").fadeIn("slow");
$(".three").fadeIn(3000);

})
})
该怎么写?
...全文
199 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Hello World, 2021-02-02
  • 打赏
  • 举报
回复
如果一开始就是显示的话,可以用fadeToggle来代替fadein,切换显示
Hello World, 2021-02-02
  • 打赏
  • 举报
回复
第一,保证脚本的路径正确 第二,要fadein的元素一开始不要显示出来

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>FadeIn Test</title>
    <style>
        div {
            display: none;
            text-align: center;
            line-height: 85px;
            font-size: 48px;
            position: absolute;
            border: 1px #CCCCCC solid;
            width: 300px;
            height: 85px;
            margin-left: 100px;
            background-color: #FFFFCC;
            vertical-align: middle;
        }

        .one {
            top: 0;
        }

        .two {
            top: 100px;
        }

        .three {
            top: 200px;
        }
    </style>

    <script type="text/javascript" src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("button").click(function () {
                $(".one").fadeIn();
                $(".two").fadeIn("slow");
                $(".three").fadeIn(3000);
            })
        })
    </script>
</head>
<body>
    <button>点击淡入</button>
    <div class="one">div1</div>
    <div class="two">div2</div>
    <div class="three">div3</div>
</body>
</html>
howcoder 2021-02-01
  • 打赏
  • 举报
回复
jquery没正确引入吧,你试着把jquery引入的地址改成:<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
recentlywe 2021-02-01
  • 打赏
  • 举报
回复
引用 2 楼 烈阳, 的回复:
又是你额,你到底在哪学的jquery额

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("#div1").fadeIn();
    $("#div2").fadeIn("slow");
    $("#div3").fadeIn(3000);
  });
});
</script>
</head>

<body>
<p>以下实例演示了 fadeIn() 使用了不同参数的效果。</p>
<button>点击淡入 div 元素。</button>
<br><br>
<div id="div1" style="width:80px;height:80px;display:none;background-color:red;"></div><br>
<div id="div2" style="width:80px;height:80px;display:none;background-color:green;"></div><br>
<div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"></div>

</body>
</html>
学jquery的话到这来学:https://www.runoob.com/jquery/jquery-tutorial.html
又是我 我在这里看的https://www.w3school.com.cn/jquery/jquery_fade.asp 和你上面那个差不多 我这和你写的那个代码也差不多 实在看不出哪里错了
recentlywe 2021-02-01
  • 打赏
  • 举报
回复
引用 1 楼 Hello World, 的回复:
发代码,不要光放截图 你要什么样子的效果,描述一下 这段代码三个两个都能用,没有的那个可以删除对应代码,也可以不管它
寒假在家无聊 就在这里面看的 里面只有三个框架的代码不知道两个框架怎么写 你说的最后一句话我还是不太理解 https://www.w3school.com.cn/jquery/jquery_fade.asp <style> .one {display:block; float:left; border:1px #CCCCCC solid; width:300px; height:85px; margin-left:300px; background-color:#FFFFCC;} .two {display:block; position:absolute; border:1px #CCCCCC solid; width:300px; height:85px; text-align:center; margin-left:300px; margin-top:100px; background-color:#FFFFCC;} .three {display:block; position:absolute; border:1px #CCCCCC solid; width:300px; height:85px; text-align:center; margin-left:300px; margin-top:200px; background-color:#FFFFCC;} </style> <script type="text/javascript" src="jquery-1.11.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $(".one").fadeIn(); $(".two").fadeIn("slow"); $(".three").fadeIn(3000); }) }) </script> </head> <body> <button>点击淡入</button> <div class="one">div1</div> <div class="two">div2</div> <div class="three">div3</div> </body> </html> 可以看清吗 排版有点乱
howcoder 2021-02-01
  • 打赏
  • 举报
回复
又是你额,你到底在哪学的jquery额

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("#div1").fadeIn();
    $("#div2").fadeIn("slow");
    $("#div3").fadeIn(3000);
  });
});
</script>
</head>

<body>
<p>以下实例演示了 fadeIn() 使用了不同参数的效果。</p>
<button>点击淡入 div 元素。</button>
<br><br>
<div id="div1" style="width:80px;height:80px;display:none;background-color:red;"></div><br>
<div id="div2" style="width:80px;height:80px;display:none;background-color:green;"></div><br>
<div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"></div>

</body>
</html>
学jquery的话到这来学:https://www.runoob.com/jquery/jquery-tutorial.html
Hello World, 2021-02-01
  • 打赏
  • 举报
回复
发代码,不要光放截图 你要什么样子的效果,描述一下 这段代码三个两个都能用,没有的那个可以删除对应代码,也可以不管它

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧