Results 1 to 4 of 4

Thread: Switch Menu - Closing Sub Categories

  1. #1
    Join Date
    Feb 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Switch Menu - Closing Sub Categories

    On this menu, some of the buttons (contact us and newswire) don't have subcategories. When you click on them, it leaves the previous menu open. Is there a way to have it close then back when going to those two categories without a submenu.

    http://www.woundcarestrategies.com/newsite/welcome.html

    Thanks!!

  2. #2
    Join Date
    Mar 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I just did this for one of my sites ----

    I included

    onclick="SwitchMenu('sub#')"

    (where # is the next number in the sequence) for those links that do not have submenus. Then I Included

    <span class="submenu" id="sub#">
    <span>

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's a very nice solution, bredding. I came up with this one a while back, a bit more complex but, it allows for simpler markup:

    Find the function SwitchMenu and replace it with this one:

    Code:
    function SwitchMenu(obj){
     if(document.getElementById){
     if (typeof obj!=='undefined')
     var el = document.getElementById(obj);
     var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
      if(typeof obj=='undefined'||el.style.display != "block"){ //DynamicDrive.com change
       for (var i=0; i<ar.length; i++){
        if (ar[i].className=="submenu") //DynamicDrive.com change
        ar[i].style.display = "none";
       }
       if (typeof obj=='undefined')
       return;
       el.style.display = "block";
      }else{
       el.style.display = "none";
      }
     }
    }
    Use this syntax for the 'dummy' menu item:

    HTML Code:
    <div class="menutitle" onclick="SwitchMenu()">Cool Links</div>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Feb 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the help!!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •