2016-01-13 145 views
1

我试图让一个fadeIn()与延迟一起工作,但由于某种原因,fadeIn()不工作。有没有人看到我在做什么错了?fadeIn()不工作与延迟()

$('#text').delay(2000).show(0).fadeIn(4200);
#text {color: blue;background-color: red;display: none;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
 
<div id="text"> 
 
Text appear! 
 
</div>

回答

4

删除.show(0)

$("#text").delay(2000).fadeIn(4200);
#text {color: blue;background-color: red;display: none;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> 
 
</script> 
 
<div id="text"> 
 
Text appear! 
 
</div>

+0

完美的发现!谢谢您的帮助! – Becky

1

你需要做的就是不说

.show() 

什么你怎么设置的逗号第二是等于说

.css("display", "block") 

有一两件事你可以做的是不是淡入的

.show("slow"); 

如果你想在效果更加跳跃。

更多信息可以在

http://api.jquery.com/show/