How Add Delay Time For Publish Any Div: jQuery


Hello Friends!,

If you want to set delay time for publish/hide to any specific block in your site then you can use the setTimeout() function.

setTimeout function can be used for reloading page, show/hide jQuery UI Datepicker and for making a div disappear or appear after few seconds.

For example, if I want to make div element fade out then you can use below code. It will fade out the div with id “dvData” after 2 seconds.

$(document).ready(function(){
//Fade out the div after 2 seconds automatically when page is loaded.
setTimeout(function(){
 $('#dvData').fadeOut();}, 2000);
//Fade in the div after 2 seconds automatically when page is loaded.
setTimeout(function(){
 $('#dvData').fadeIn();}, 2000);
});

Enjoy Code | Raghunath Blog

Advertisements

Sr. Software Engineer

Tagged with: , ,
Posted in JQuery

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: