Posted By

nerdfiles on 06/16/09


Tagged

javascript jquery suckerfish


Versions (?)

Suckerfish Dropdown Menu Script (without reloading page, in jQuery)


 / Published in: JavaScript
 

[div] [div] ul [div] ul li [div] ul li a [div] ul li ul [div] ul li ul li [div] ul li ul li a
  1. $("#menu > ul > li > ul > li > a").click(function() {
  2. if ($(this).attr("rel") == "external") {
  3. window.open(this.href);
  4. return false;
  5. } else {
  6. window.location=this.href;
  7. }
  8. });
  9.  
  10. $('#menu > ul > li').click(
  11. function(event){
  12. var getList = this.getElementsByTagName('ul')[0];
  13.  
  14. if ($(getList).css("display") == "block") {
  15. $(getList).css("display", "none");
  16. if ($('#menu ul li').click) {
  17. event.preventDefault();
  18. }
  19. } else {
  20. for (i=0;i<=3;i++) {
  21. $("#menu ul li ul").css('display', 'none');
  22. }
  23.  
  24. $(this.getElementsByTagName('ul')[0]).css('display', 'block');
  25. }
  26.  
  27. }
  28. );

Report this snippet  

You need to login to post a comment.