jQuery Timed Event

心已入冬 提交于 2019-11-30 17:34:23
var doIt = function() {
    $("div.my").text("My message");
}
setTimeout(doIt, 3000);

if you're using jQuery 1.4, you can always do:

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

I've been using the following jQuery plugins below for this. Delay can be used with chained functions, notNow can't.

Delay

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

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

notNow

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

$.notNow(2000, function() { 
    alert('woolsworth');
});
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!