Change on DIV to another Animation


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



Copy this code and paste it in your HTML
  1. HTML:
  2. <div id="container">
  3. <div id="div1"></div>
  4. <div id="div2"></div>
  5. </div>
  6.  
  7. CSS:
  8. #container {
  9. position:relative;
  10. width:400px;
  11. height:200px;
  12. }
  13. #container > div {
  14. position:absolute;
  15. top:0;
  16. left:0;
  17. min-width:400px;
  18. min-height:200px;
  19. width:400px;
  20. height:200px;
  21. }
  22. #div1 {
  23. background:red;
  24. }
  25. #div2 {
  26. background:blue;
  27. }
  28.  
  29. jQuery:
  30. $('#div1').hide();
  31. setInterval(function() {
  32. $('#container div').toggle(500);
  33. }, 2000)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.