Home >Web Front-end >JS Tutorial >How jQuery automatically hides specified elements after a period of time_jquery
The example in this article describes how jQuery automatically hides specified elements after a period of time. Share it with everyone for your reference. The details are as follows:
The following code provides two methods for timing hidden elements. The first is to use setTimeout, and the second is to use the delay method provided in jQuery 1.4 and later versions. The second is simpler.
//这是1.3.2中我们使用setTimeout来实现的方式 //http://www.jb51.net setTimeout(function() { $('.showdiv').hide('blind', {}, 500) }, 5000); //这是在1.4中可以使用delay()这一功能来实现的方式 //(这很像是休眠) $(".showdiv").delay(5000).hide('blind', {}, 500);
I hope this article will be helpful to everyone’s jQuery programming.