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

Leave a Reply

Your email address will not be published. Required fields are marked *