2010-02-05 5 views

risposta

27
var doIt = function() { 
    $("div.my").text("My message"); 
} 
setTimeout(doIt, 3000); 
15

se si sta utilizzando jQuery 1.4, si può sempre fare:

 
$(function() { 
    $('#divId').delay(3000).text('New Text'); 
});

4

Sto usando il plugin seguenti jQuery sotto per questo. Il ritardo può essere utilizzato con le funzioni concatenate, non è possibile.

Ritardo

http://plugins.jquery.com/project/delay

$('#animate-this').fadeIn().delay(500).fadeOut(); 

notNow

http://plugins.jquery.com/project/notNow

$.notNow(2000, function() { 
    alert('woolsworth'); 
}); 
+1

+1 Credo che il ritardo plug-yo hai menzionato in realtà ora parte della libreria jQuery principale, come da mia risposta. –