2010-11-30 6 views
1

Comment ajouter un fondu à cela?Comment ajouter un fondu?

$(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]);  

});

Répondre

3

Vous pouvez juste un chaîne .hide() avec un .fadeIn(), comme ceci:

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

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

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

ne pouvait pas être plus facile.

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

Assurez-vous que #quoteHome est réglé sur display:none du getgo.

1

Utilisez cette méthode:

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