Posted By

tcelestino on 10/07/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

spee66


Hide div with setTimeout


 / Published in: jQuery
 

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>hide div com setInterval</title>
  6. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js"></script>
  7. <script>
  8. $(document).ready(function() {
  9. function sumir_floater() {
  10. var div = $("#floater");
  11. div.fadeIn();
  12. div.queue(function() {
  13. setTimeout(function() {
  14. div.dequeue();
  15. }, 5000);
  16. });
  17. div.fadeOut("fast");
  18. }
  19.  
  20. sumir_floater();
  21.  
  22. });
  23. </script>
  24. </head>
  25.  
  26. <body>
  27. <div id="floater">
  28. <p>Image or Text here</p>
  29. </div>
  30. </body>
  31. </html>

Report this snippet  

You need to login to post a comment.