Home  >  Article  >  Web Front-end  >  How jQuery automatically hides specified elements after a period of time_jquery

How jQuery automatically hides specified elements after a period of time_jquery

WBOY
WBOYOriginal
2016-05-16 16:09:06952browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn