jquery collapse expand


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



Copy this code and paste it in your HTML
  1. INSIDE THE HEAD
  2. ......................................................................
  3.  
  4. <script type="text/javascript" src="jquery.js"></script>
  5. <script type="text/javascript">
  6. $(function()
  7. {
  8.  
  9. $("#trigger").click(function(event) {
  10. event.preventDefault();
  11. $("#box").slideToggle();
  12. });
  13.  
  14. $("#box a").click(function(event) {
  15. event.preventDefault();
  16. $("#box").slideUp();
  17. });
  18. });
  19.  
  20.  
  21. HTML
  22. ......................................................................
  23.  
  24. <a href="#" id="trigger">TRIGGER</a>
  25.  
  26. <div id="box">
  27. <a href="#" class="close">[x]</a>
  28. <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren</p>
  29. </div>
  30.  
  31. CSS
  32. ......................................................................
  33. #box {
  34. display: none;
  35. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.