Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2006
    Posts
    88
    Thanks
    4
    Thanked 1 Time in 1 Post

    Menu, click new menu item, and close open menu item?

    Current code is

    Code:
    function toggleMenu(objID) {
    if (!document.getElementById) return;
    var ob = document.getElementById(objID).style;
    ob.display = (ob.display == 'block')?'none': 'block';
    }

    Code:
    <ul>
    <li onClick="toggleMenu('manufacturer8')"><a href="#">man 8</a></li>
    </ul>
    <div id="manufacturer8" class="mL">
    <ul>
    <li><a href="#">product</a></li>
    </ul>
    </div>
    I would like it so when you click one of the menu items like man 8 the other open menu item like man 4 closes, at the moment you click them all and they all stay open and it scrolls down the page too much. Any ideas?

  • #2
    New Coder
    Join Date
    Sep 2006
    Posts
    32
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Here is a link to an example of one way you could do it:
    http://www.dynamicdrive.com/dynamici...switchmenu.htm

  • #3
    New Coder
    Join Date
    Jan 2006
    Posts
    88
    Thanks
    4
    Thanked 1 Time in 1 Post
    Thanks, not an easier way just adding a bit of code, got lost trying to modify that code


  •  

    Posting Permissions

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