Home > Web Front-end > JS Tutorial > body text

How jQuery automatically hides specified elements after a period of time_jquery

WBOY
Release: 2016-05-16 16:09:06
Original
995 people have browsed it

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);
Copy after login

I hope this article will be helpful to everyone’s jQuery programming.

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template