开发者

How do I add a fade in?

How would I add a fade in to this?

  $(document).ready(function(){
  var myQuotes = new Array(); 
  myQuotes[0] = "All is connected... "; 
  myQuotes[1] = "The best way"; 
  myQuotes[2]开发者_如何学编程 = "Your work is to discover"; 
  myQuotes[2] = "If success";

  var myRandom = Math.floor(Math.random()*myQuotes.length); 
  $('#quoteHome').html(myQuotes[myRandom]);      

});


You can just chain a .hide() with a .fadeIn(), like this:

$('#quoteHome').html(myQuotes[myRandom]).hide().fadeIn();


Use this method:

$('#quoteHome').hide().html(myQuotes[myRandom]).fadeIn('fast');


 $('#quoteHome').fadeIn();

 $('#quoteHome').fadeIn(1000); //duration in milliseconds

 $('#quoteHome').fadeIn('fast'); //speed


couldn't be easier.

$('#quoteHome').html(myQuotes[myRandom]).fadeIn('slow');

Just make sure that #quoteHome is set to display:none from the getgo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜