编码新手,我很高兴能够学到所有东西。但是,目前存在一个问题。我希望我的第一个标题可以淡出,但绝对不行。代码如下:
3
5
7
The value 3 was deleted
5
7
------------------------
index = 0
42
The num of items in index = 1
------------------------
------------------------
index = 1
23
The num of items in index = 4
------------------------
------------------------
index = 2
0
The num of items in index = 0
------------------------
------------------------
index = 3
4
The num of items in index = 2
------------------------
------------------------
index = 4
0
The num of items in index = 0
------------------------
------------------------
index = 5
0
The num of items in index = 0
------------------------
------------------------
index = 6
10
The num of items in index = 4
------------------------
------------------------
index = 7
0
The num of items in index = 0
------------------------
------------------------
index = 8
9
The num of items in index = 1
------------------------
------------------------
index = 9
0
The num of items in index = 0
------------------------
$(document).ready(function() {
$("#firstheader").fadeOut('slow', 500);
});
#firstheader {
font-family: Helvetica, Arial, sans-serif;
font-size: 20px;
color: red;
text-align: center;
}
任何帮助将不胜感激。这真的让我很难过。
答案 0 :(得分:3)
fadeOut()
取slow/fast
或持续时间而不是两者同时如此:
$("#firstheader").fadeOut('slow');
或者:
$("#firstheader").fadeOut(500);
希望这有帮助。
$(document).ready(function() {
$("#firstheader").fadeOut('slow');
});

#firstheader {
font-family: Helvetica, Arial, sans-serif;
font-size: 20px;
color: red;
text-align: center;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="firstheader">
<h1>
Global HypeBeast: Street Fashion WORLDWIDE
</h1>
</div>
&#13;
答案 1 :(得分:2)
好吧,如果你查看fadeOut的文档: http://api.jquery.com/fadeout/
您似乎可以说“慢”,或者手动设置持续时间:)
干杯,
编辑:根据Rory McCrossan的真实评论修改我的答案。
答案 2 :(得分:1)
仅供参考:.fadeOut()
没有采用两种速度参数。
$(document).ready(function() {
$("#firstheader").fadeOut(5000);
});
&#13;
#firstheader {
font-family: Helvetica, Arial, sans-serif;
font-size: 20px;
color: red;
text-align: center;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div id="firstheader">
<h1>Global HypeBeast: Street Fashion WORLDWIDE</h1>
</div>
&#13;
答案 3 :(得分:0)
您定位的是h1
元素,但淡出了容器div。而是这样做:
$(document).ready(function() {
$("#firstheader h1").fadeIn('slow');
});
并在css中:
#firstheader h1{
display:none;
}
由于问题已编辑为fadeOut
而不是fadeIn
:
$("#firstheader h1").fadeOut('slow');