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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dynamic folder tree menu not folding

    Hello all.....

    I got a Switch Menu script from Dynamic Drive - a folding tree nav menu. Didn't have to do much configuring of the html - just changed a span to a div, but I think that's messing up in the javascript.

    This is the html for a menu entry and a sub menu:
    <.div id="masterdiv">

    <div class="menutitle" onclick="SwitchMenu('sub1')"><a href="index.php?page=ministries/adults">Adults</a></div>
    <div class="submenu" id="sub1">
    <a href="index.php?page=ministries/adults">Adult Fellowships</a><br>
    <a href="index.php?page=ministries/adults">Adult Electives</a><br>
    <a href="index.php?page=ministries/adults">Home Bible studies</a><br>
    <a href="index.php?page=ministries/adults">What about Sunday School?</a>
    <./div>
    <./div>

    I changed the submenu span class to a div class because the span class was only indenting the first line of the submenu.

    This is the javascript:
    <script type="javascript">
    if (document.getElementById){ //DynamicDrive.com change
    document.write('<style type="text/css">\n')
    document.write('.submenu{display: none;}\n')
    document.write('</style>\n')
    }

    function SwitchMenu(obj){
    if(document.getElementById){
    var el = document.getElementById(obj);
    var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
    if(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";
    }
    el.style.display = "block";
    }else{
    el.style.display = "none";
    }
    }
    }

    </script>

    The problem is that the page opens with the menu opened up and it's not collapsing when the top level link is clicked. Here it is in action:
    http://mckinneychurch.com/checkthiso...age=ministries
    It's the list in the right side column - the submenus are indented 15px.

    What might the matter be? Thanks for any attention!

    sherill

  • #2
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    wrong forum?

    I suppose I should have put this in the Dynamic Drive scripts help forum. How do I go about moving it? So sorry!!

    sherill


  •  

    Posting Permissions

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