Search

Facebook and Twitter Take Over Customer Service?

Landing Pages Mystery Revealed

Amazing Non-Stock Images

How to Survive a Cataclysm Known as "Abandoned Shopping Cart?"

How to Create Winning Marketing Strategy in Six Steps

Integrating Magento and WordPress using the WordPress REST API

jQuery setTimeout

In categories: JavaScript, jQuery published on 22.07.2010 by Dejan Jacimovic

In order to make certain jQuery function run after some amount of time, you can use setTimeout – a JavaScript function. Here is a snippet that will remove loading mask from your page, one second after a website was loaded.

1
2
3
4
5
jQuery(document).ready(function () {
	setTimeout( function() {
		jQuery('#loading_mask').hide();
	}, 1000 );
});

Note: You can setup loading mask to cover your whole website, or just some part (image gallery for example). This way you can achieve nice effect so user won’t see loading images.

  • Was this helpful?
  • Yes   No