Automatically hide or close elements after an amount of time (jQuery)


/ Published in: jQuery
Save to your folder(s)

Automatically hide or close elements after an amount of time (jQuery)


Copy this code and paste it in your HTML
  1. //Here's how we used to do it in 1.3.2 using setTimeout
  2.  
  3. setTimeout(function() {
  4. $('.mydiv').hide('blind', {}, 500)
  5. }, 5000);
  6.  
  7.  
  8.  
  9. //And here's how you can do it with 1.4 using the delay() feature (this is a lot like sleep)
  10.  
  11. $(".mydiv").delay(5000).hide('blind', {}, 500);

URL: http://codesnippets.info/jquery/automatically-hide-or-close-elements-after-an-amount-of-time/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.