Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Second horizontal suckertreemenu

  1. #1
    Join Date
    Apr 2008
    Location
    Glasgow, Scotland
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Second horizontal suckertreemenu

    I need a second horizontal suckertree menu - the first expands/drops down - the second is horizontal only. When I attempt to combine them on one page the second adopts the width attributes of the first. I need to be able to control the width factor which has to be different in each menu. Thanks in advance.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Here, lets make sure you did it right, you need to put in here:
    Code:
    var menuids=["treemenu1"]
    Then add a , then place in the next ul, example:
    Code:
    var menuids=["treemenu1"],["2"]
    Then I'd make another:
    Code:
    <ul id="2">
    <li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Folder 1</a>
      <ul>
      <li><a href="#">Sub Item 1.1</a></li>
      <li><a href="#">Sub Item 1.2</a></li>
      <li><a href="#">Sub Item 1.3</a></li>
      <li><a href="#">Sub Item 1.4</a></li>
      </ul>
    </li>
    <li><a href="#">Item 3</a></li>
    <li><a href="#">Folder 2</a>
      <ul>
      <li><a href="#">Sub Item 2.1</a></li>
      <li><a href="#">Folder 2.1</a>
        <ul>
        <li><a href="#">Sub Item 2.1.1</a></li>
        <li><a href="#">Sub Item 2.1.2</a></li>
        <li><a href="#">Sub Item 2.1.3</a></li>
        <li><a href="#">Sub Item 2.1.4</a></li>
        </ul>
      </li>
    </ul>
    </a>
    </li>
    <li><a href="#">Item 4</a></li>
    </ul>
    Hope this helps, I need your code to make it really help.
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    wiswag (04-08-2008)

  4. #3
    Join Date
    Apr 2008
    Location
    Glasgow, Scotland
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Thanks - see my attempt

    <style type="text/css">

    .suckertreemenu ul{
    margin: 0;
    padding: 0;
    width: 100%;
    list-style-type: none; bold; font-style:normal; font-variant:normal; font-weight:bold; font-size:12px; font-family:Tahoma
    }

    /*Top level list items*/
    .suckertreemenu ul li{
    position: relative;
    display: inline;
    float: left;
    background-color: #2c3169; /*overall menu background color*/
    }

    /*Top level menu link items style*/
    .suckertreemenu ul li a{
    border-left:0px solid white; border-right:1px solid white; border-top:1px solid white; border-bottom:1px solid white; display: block;
    width: 125px; /*Width of top level menu link items*/
    text-decoration: none;
    color: white; padding-left:8px; padding-right:8px; padding-top:1px; padding-bottom:1px
    }

    /*1st sub level menu*/
    .suckertreemenu ul li ul{
    left: 0;
    position: absolute;
    top: 1em; /* no need to change, as true value set by script */
    display: block;
    visibility: hidden;
    }

    /*Sub level menu list items (undo style from Top level List Items)*/
    .suckertreemenu ul li ul li{
    display: list-item;
    float: none;
    }

    /*All subsequent sub menu levels offset after 1st level sub menu */
    .suckertreemenu ul li ul li ul{
    left: 130px; /* no need to change, as true value set by script */
    top: 0;
    }

    /* Sub level menu links style */
    .suckertreemenu ul li ul li a{
    display: block;
    width: 125px; /*width of sub menu levels*/
    color: white;
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid #ccc;
    }

    .suckertreemenu ul li a:hover{
    background-color: #008080;
    color: white;
    }

    /*Background image for top level menu list links */
    .suckertreemenu .mainfoldericon{
    background: #2c3169 url('media/arrow-down.gif') no-repeat center right;
    }

    /*Background image for subsequent level menu list links */
    .suckertreemenu .subfoldericon{
    background: #2c3169 url('media/arrow-right.gif') no-repeat center right;
    }

    * html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
    padding-top: 2em;
    }

    /* Holly Hack for IE \*/
    * html .suckertreemenu ul li { float: left; height: 1%;}
    * html .suckertreemenu ul li a { height: 1%;}
    * html .suckertreemenu ul li ul li { float: left;}
    * html .suckertreemenu ul li ul li a{ margin-top:-2px;
    /* End */

    </style>

    <style type="text/css">


    .suckertreemenu1 ul{
    margin: 0;
    padding: 0;
    width: 100%;
    list-style-type: none; bold; font-style:normal; font-variant:normal; font-weight:bold; font-size:12px; font-family:Tahoma
    }

    /*Top level list items*/
    .suckertreemenu1 ul li{
    position: relative;
    display: inline;
    float: left;
    background-color: #2c3169; /*overall menu background color*/
    }

    /*Top level menu link items style*/
    .suckertreemenu1 ul li a{
    border-left:0px solid white; border-right:1px solid white; border-top:1px solid white; border-bottom:1px solid white; display: block;
    width: 130px; /*Width of top level menu link items*/
    text-decoration: none;
    color: white; padding-left:8px; padding-right:8px; padding-top:1px; padding-bottom:1px
    }

    /*1st sub level menu*/
    .suckertreemenu1 ul li ul{
    left: 0;
    position: absolute;
    top: 1em; /* no need to change, as true value set by script */
    display: block;
    visibility: hidden;
    }

    /*Sub level menu list items (undo style from Top level List Items)*/
    .suckertreemenu1 ul li ul li{
    display: list-item;
    float: none;
    }

    /*All subsequent sub menu levels offset after 1st level sub menu */
    .suckertreemenu1 ul li ul li ul{
    left: 130px; /* no need to change, as true value set by script */
    top: 0;
    }

    /* Sub level menu links style */
    .suckertreemenu1 ul li ul li a{
    display: block;
    width: 130px; /*width of sub menu levels*/
    color: white;
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid #ccc;
    }

    .suckertreemenu1 ul li a:hover{
    background-color: #008080;
    color: white;
    }

    /*Background image for top level menu list links */
    .suckertreemenu1 .mainfoldericon{
    background: #2c3169 url('media/arrow-down.gif') no-repeat center right;
    }

    /*Background image for subsequent level menu list links */
    .suckertreemenu1 .subfoldericon{
    background: #2c3169 url('media/arrow-right.gif') no-repeat center right;
    }

    * html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
    padding-top: 2em;
    }

    /* Holly Hack for IE \*/
    * html .suckertreemenu1 ul li { float: left; height: 1%;}
    * html .suckertreemenu1 ul li a { height: 1%;}
    * html .suckertreemenu1 ul li ul li { float: left;}
    * html .suckertreemenu1 ul li ul li a{ margin-top:-2px;
    /* End */

    </style>

    <script type="text/javascript">

    var menuids=["treemenu1","treemenu2"] //Enter id(s) of SuckerTree UL menus, separated by commas

    function buildsubmenus_horizontal(){
    for (var i=0; i<menuids.length; i++){
    var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
    ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
    ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
    }
    else{ //else if this is a sub level menu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
    }
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
    }
    }

    if (window.addEventListener)
    window.addEventListener("load", buildsubmenus_horizontal, false)
    else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus_horizontal)

    </script>

    </style>

    **////HtmlCode 1st menu////**

    <div class="suckertreemenu" align="center">>
    <ul id="treemenu1">
    <li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Folder 1</a>
    <ul>
    <li><a href="#">Sub Item 1.1</a></li>
    <li><a href="#">Sub Item 1.2</a></li>
    <li><a href="#">Sub Item 1.3</a></li>
    <li><a href="#">Sub Item 1.4</a></li>
    </ul>
    </li>
    <li><a href="#">Item 3</a></li>
    <li><a href="#">Folder 2</a>
    <ul>
    <li><a href="#">Sub Item 2.1</a></li>
    <li><a href="#">Folder 2.1</a>
    <ul>
    <li><a href="#">Sub Item 2.1.1</a></li>
    <li><a href="#">Sub Item 2.1.2</a></li>
    <li><a href="#">Sub Item 2.1.3</a></li>
    <li><a href="#">Sub Item 2.1.4</a></li>
    </ul>
    </li>
    </ul>
    </a>
    </li>
    <li><a href="#">Item 4</a></li>
    </ul>
    <br style="clear: left;" />
    </div>

    **////HtmlCode 2nd menu////**

    <div class="suckertreemenu" align="center">
    <ul id="treemenu2">
    <li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Item 3</a></li>
    <li><a href="#">Item 4</a></li>
    <li><a href="#">Item 5</a></li>
    <li><a href="#">Item 6</a></li>
    </ul>
    <br style="clear: left;" />
    </div>


    When I tried your suggestion the attribute of width is fine for the second menu, however it applies this width to the first preventing it from functioning.
    Thanks in advance

  5. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Here, you need to take a look at the html code. It was wrong, you weren't applying any hover on it and thats why it didn't have the hover affect:

    Code:
    <style type="text/css">
    
    .suckertreemenu ul{
    margin: 0;
    padding: 0;
    width: 100%;
    list-style-type: none; bold; font-style:normal; font-variant:normal; font-weight:bold; font-size:12px; font-family:Tahoma
    }
    
    /*Top level list items*/
    .suckertreemenu ul li{
    position: relative;
    display: inline;
    float: left;
    background-color: #2c3169; /*overall menu background color*/
    }
    
    /*Top level menu link items style*/
    .suckertreemenu ul li a{
    border-left:0px solid white; border-right:1px solid white; border-top:1px solid white; border-bottom:1px solid white; display: block;
    width: 125px; /*Width of top level menu link items*/
    text-decoration: none;
    color: white; padding-left:8px; padding-right:8px; padding-top:1px; padding-bottom:1px
    }
    
    /*1st sub level menu*/
    .suckertreemenu ul li ul{
    left: 0;
    position: absolute;
    top: 1em; /* no need to change, as true value set by script */
    display: block;
    visibility: hidden;
    }
    
    /*Sub level menu list items (undo style from Top level List Items)*/
    .suckertreemenu ul li ul li{
    display: list-item;
    float: none;
    }
    
    /*All subsequent sub menu levels offset after 1st level sub menu */
    .suckertreemenu ul li ul li ul{
    left: 130px; /* no need to change, as true value set by script */
    top: 0;
    }
    
    /* Sub level menu links style */
    .suckertreemenu ul li ul li a{
    display: block;
    width: 125px; /*width of sub menu levels*/
    color: white;
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid #ccc;
    }
    
    .suckertreemenu ul li a:hover{
    background-color: #008080;
    color: white;
    }
    
    /*Background image for top level menu list links */
    .suckertreemenu .mainfoldericon{
    background: #2c3169 url('media/arrow-down.gif') no-repeat center right;
    }
    
    /*Background image for subsequent level menu list links */
    .suckertreemenu .subfoldericon{
    background: #2c3169 url('media/arrow-right.gif') no-repeat center right;
    }
    
    * html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
    padding-top: 2em;
    }
    
    /* Holly Hack for IE \*/
    * html .suckertreemenu ul li { float: left; height: 1%;}
    * html .suckertreemenu ul li a { height: 1%;}
    * html .suckertreemenu ul li ul li { float: left;}
    * html .suckertreemenu ul li ul li a{ margin-top:-2px;
    /* End */
    
    </style>
    
    <style type="text/css">
    
    
    .suckertreemenu1 ul{
    margin: 0;
    padding: 0;
    width: 100%;
    list-style-type: none; bold; font-style:normal; font-variant:normal; font-weight:bold; font-size:12px; font-family:Tahoma
    }
    
    /*Top level list items*/
    .suckertreemenu1 ul li{
    position: relative;
    display: inline;
    float: left;
    background-color: #2c3169; /*overall menu background color*/
    }
    
    /*Top level menu link items style*/
    .suckertreemenu1 ul li a{
    border-left:0px solid white; border-right:1px solid white; border-top:1px solid white; border-bottom:1px solid white; display: block;
    width: 130px; /*Width of top level menu link items*/
    text-decoration: none;
    color: white; padding-left:8px; padding-right:8px; padding-top:1px; padding-bottom:1px
    }
    
    /*1st sub level menu*/
    .suckertreemenu1 ul li ul{
    left: 0;
    position: absolute;
    top: 1em; /* no need to change, as true value set by script */
    display: block;
    visibility: hidden;
    }
    
    /*Sub level menu list items (undo style from Top level List Items)*/
    .suckertreemenu1 ul li ul li{
    display: list-item;
    float: none;
    }
    
    /*All subsequent sub menu levels offset after 1st level sub menu */
    .suckertreemenu1 ul li ul li ul{
    left: 130px; /* no need to change, as true value set by script */
    top: 0;
    }
    
    /* Sub level menu links style */
    .suckertreemenu1 ul li ul li a{
    display: block;
    width: 130px; /*width of sub menu levels*/
    color: white;
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid #ccc;
    }
    
    .suckertreemenu1 ul li a:hover{
    background-color: #008080;
    color: white;
    }
    
    /*Background image for top level menu list links */
    .suckertreemenu1 .mainfoldericon{
    background: #2c3169 url('media/arrow-down.gif') no-repeat center right;
    }
    
    /*Background image for subsequent level menu list links */
    .suckertreemenu1 .subfoldericon{
    background: #2c3169 url('media/arrow-right.gif') no-repeat center right;
    }
    
    * html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
    padding-top: 2em;
    }
    
    /* Holly Hack for IE \*/
    * html .suckertreemenu1 ul li { float: left; height: 1%;}
    * html .suckertreemenu1 ul li a { height: 1%;}
    * html .suckertreemenu1 ul li ul li { float: left;}
    * html .suckertreemenu1 ul li ul li a{ margin-top:-2px;
    /* End */
    
    </style>
    
    <script type="text/javascript">
    
    var menuids=["treemenu1","treemenu2"] //Enter id(s) of SuckerTree UL menus, separated by commas
    
    function buildsubmenus_horizontal(){
    for (var i=0; i<menuids.length; i++){
    var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
    ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
    ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
    }
    else{ //else if this is a sub level menu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
    }
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
    }
    }
    
    if (window.addEventListener)
    window.addEventListener("load", buildsubmenus_horizontal, false)
    else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus_horizontal)
    
    </script>
    
    </style>
    
    **////HtmlCode 1st menu////**
    
    <div class="suckertreemenu" align="center">>
    <ul id="treemenu1">
    <li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Folder 1</a>
    <ul>
    <li><a href="#">Sub Item 1.1</a></li>
    <li><a href="#">Sub Item 1.2</a></li>
    <li><a href="#">Sub Item 1.3</a></li>
    <li><a href="#">Sub Item 1.4</a></li>
    </ul>
    </li>
    <li><a href="#">Item 3</a></li>
    <li><a href="#">Folder 2</a>
    <ul>
    <li><a href="#">Sub Item 2.1</a></li>
    <li><a href="#">Folder 2.1</a>
    <ul>
    <li><a href="#">Sub Item 2.1.1</a></li>
    <li><a href="#">Sub Item 2.1.2</a></li>
    <li><a href="#">Sub Item 2.1.3</a></li>
    <li><a href="#">Sub Item 2.1.4</a></li>
    </ul>
    </li>
    </ul>
    </a>
    </li>
    <li><a href="#">Item 4</a></li>
    </ul>
    <br style="clear: left;" />
    </div>
    
    **////HtmlCode 2nd menu////**
    
    <div class="suckertreemenu" align="center">
    <ul id="treemenu2">
    <li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Folder 1</a>
    <ul>
    <li><a href="#">Sub Item 1.1</a></li>
    <li><a href="#">Sub Item 1.2</a></li>
    <li><a href="#">Sub Item 1.3</a></li>
    <li><a href="#">Sub Item 1.4</a></li>
    </ul>
    </li>
    <li><a href="#">Item 3</a></li>
    <li><a href="#">Folder 2</a>
    <ul>
    <li><a href="#">Sub Item 2.1</a></li>
    <li><a href="#">Folder 2.1</a>
    <ul>
    <li><a href="#">Sub Item 2.1.1</a></li>
    <li><a href="#">Sub Item 2.1.2</a></li>
    <li><a href="#">Sub Item 2.1.3</a></li>
    <li><a href="#">Sub Item 2.1.4</a></li>
    </ul>
    </li>
    </ul>
    </a>
    </li>
    <li><a href="#">Item 4</a></li>
    </ul>
    <br style="clear: left;" />
    </div>
    Jeremy | jfein.net

  6. The Following User Says Thank You to Nile For This Useful Post:

    wiswag (04-09-2008)

  7. #5
    Join Date
    Apr 2008
    Location
    Glasgow, Scotland
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Exclamation Thanks Nile - made mistake, I pasted 1st html menu twice.

    <style type="text/css">

    .suckertreemenu ul{
    margin: 0;
    padding: 0;
    width: 100%;
    list-style-type: none; bold; font-style:normal; font-variant:normal; font-weight:bold; font-size:12px; font-family:Tahoma
    }

    /*Top level list items*/
    .suckertreemenu ul li{
    position: relative;
    display: inline;
    float: left;
    background-color: #2c3169; /*overall menu background color*/
    }

    /*Top level menu link items style*/
    .suckertreemenu ul li a{
    border-left:0px solid white; border-right:1px solid white; border-top:1px solid white; border-bottom:1px solid white; display: block;
    width: 125px; /*Width of top level menu link items*/
    text-decoration: none;
    color: white; padding-left:8px; padding-right:8px; padding-top:1px; padding-bottom:1px
    }

    /*1st sub level menu*/
    .suckertreemenu ul li ul{
    left: 0;
    position: absolute;
    top: 1em; /* no need to change, as true value set by script */
    display: block;
    visibility: hidden;
    }

    /*Sub level menu list items (undo style from Top level List Items)*/
    .suckertreemenu ul li ul li{
    display: list-item;
    float: none;
    }

    /*All subsequent sub menu levels offset after 1st level sub menu */
    .suckertreemenu ul li ul li ul{
    left: 130px; /* no need to change, as true value set by script */
    top: 0;
    }

    /* Sub level menu links style */
    .suckertreemenu ul li ul li a{
    display: block;
    width: 125px; /*width of sub menu levels*/
    color: white;
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid #ccc;
    }

    .suckertreemenu ul li a:hover{
    background-color: #008080;
    color: white;
    }

    /*Background image for top level menu list links */
    .suckertreemenu .mainfoldericon{
    background: #2c3169 url('media/arrow-down.gif') no-repeat center right;
    }

    /*Background image for subsequent level menu list links */
    .suckertreemenu .subfoldericon{
    background: #2c3169 url('media/arrow-right.gif') no-repeat center right;
    }

    * html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
    padding-top: 2em;
    }

    /* Holly Hack for IE \*/
    * html .suckertreemenu ul li { float: left; height: 1%;}
    * html .suckertreemenu ul li a { height: 1%;}
    * html .suckertreemenu ul li ul li { float: left;}
    * html .suckertreemenu ul li ul li a{ margin-top:-2px;
    /* End */

    </style>

    <style type="text/css">


    .suckertreemenu1 ul{
    margin: 0;
    padding: 0;
    width: 100%;
    list-style-type: none; bold; font-style:normal; font-variant:normal; font-weight:bold; font-size:12px; font-family:Tahoma
    }

    /*Top level list items*/
    .suckertreemenu1 ul li{
    position: relative;
    display: inline;
    float: left;
    background-color: #2c3169; /*overall menu background color*/
    }

    /*Top level menu link items style*/
    .suckertreemenu1 ul li a{
    border-left:0px solid white; border-right:1px solid white; border-top:1px solid white; border-bottom:1px solid white; display: block;
    width: 130px; /*Width of top level menu link items*/
    text-decoration: none;
    color: white; padding-left:8px; padding-right:8px; padding-top:1px; padding-bottom:1px
    }

    /*1st sub level menu*/
    .suckertreemenu1 ul li ul{
    left: 0;
    position: absolute;
    top: 1em; /* no need to change, as true value set by script */
    display: block;
    visibility: hidden;
    }

    /*Sub level menu list items (undo style from Top level List Items)*/
    .suckertreemenu1 ul li ul li{
    display: list-item;
    float: none;
    }

    /*All subsequent sub menu levels offset after 1st level sub menu */
    .suckertreemenu1 ul li ul li ul{
    left: 130px; /* no need to change, as true value set by script */
    top: 0;
    }

    /* Sub level menu links style */
    .suckertreemenu1 ul li ul li a{
    display: block;
    width: 130px; /*width of sub menu levels*/
    color: white;
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid #ccc;
    }

    .suckertreemenu1 ul li a:hover{
    background-color: #008080;
    color: white;
    }

    /*Background image for top level menu list links */
    .suckertreemenu1 .mainfoldericon{
    background: #2c3169 url('media/arrow-down.gif') no-repeat center right;
    }

    /*Background image for subsequent level menu list links */
    .suckertreemenu1 .subfoldericon{
    background: #2c3169 url('media/arrow-right.gif') no-repeat center right;
    }

    * html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
    padding-top: 2em;
    }

    /* Holly Hack for IE \*/
    * html .suckertreemenu1 ul li { float: left; height: 1%;}
    * html .suckertreemenu1 ul li a { height: 1%;}
    * html .suckertreemenu1 ul li ul li { float: left;}
    * html .suckertreemenu1 ul li ul li a{ margin-top:-2px;
    /* End */

    </style>

    <script type="text/javascript">

    var menuids=["treemenu1","treemenu2"] //Enter id(s) of SuckerTree UL menus, separated by commas

    function buildsubmenus_horizontal(){
    for (var i=0; i<menuids.length; i++){
    var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
    ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
    ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
    }
    else{ //else if this is a sub level menu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
    }
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
    }
    }

    if (window.addEventListener)
    window.addEventListener("load", buildsubmenus_horizontal, false)
    else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus_horizontal)

    </script>

    </style>

    **////HtmlCode 1st menu////**

    <div class="suckertreemenu" align="center">>
    <ul id="treemenu1">
    <li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Folder 1</a>
    <ul>
    <li><a href="#">Sub Item 1.1</a></li>
    <li><a href="#">Sub Item 1.2</a></li>
    <li><a href="#">Sub Item 1.3</a></li>
    <li><a href="#">Sub Item 1.4</a></li>
    </ul>
    </li>
    <li><a href="#">Item 3</a></li>
    <li><a href="#">Folder 2</a>
    <ul>
    <li><a href="#">Sub Item 2.1</a></li>
    <li><a href="#">Folder 2.1</a>
    <ul>
    <li><a href="#">Sub Item 2.1.1</a></li>
    <li><a href="#">Sub Item 2.1.2</a></li>
    <li><a href="#">Sub Item 2.1.3</a></li>
    <li><a href="#">Sub Item 2.1.4</a></li>
    </ul>
    </li>
    </ul>
    </a>
    </li>
    <li><a href="#">Item 4</a></li>
    </ul>
    <br style="clear: left;" />
    </div>

    **////HtmlCode 2nd menu////**

    <div class="suckertreemenu" align="center">
    <ul id="treemenu2">
    <li><a href="#" style="border-left: 1px solid black">Name 1</a></li>
    <li><a href="#">Name 2</a></li>
    <li><a href="#">Name 3</a></li>
    <li><a href="#">Name 4</a></li>
    <li><a href="#">Name 5</a></li>
    <li><a href="#">Name 6</a></li>
    </ul>
    <br style="clear: left;" />
    </div>

  8. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    So did my script work?
    Jeremy | jfein.net

  9. The Following User Says Thank You to Nile For This Useful Post:

    wiswag (04-11-2008)

  10. #7
    Join Date
    Apr 2008
    Location
    Glasgow, Scotland
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I am afraid your coding didn't do what I was looking for. I am trying to get the second menu to have a different width (/*Top level menu link items style*/) from the first. I've tried various permutations without success. Thanks again.

  11. #8
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by wiswag View Post
    I am afraid your coding didn't do what I was looking for. I am trying to get the second menu to have a different width (/*Top level menu link items style*/) from the first. I've tried various permutations without success. Thanks again.
    Apply a different class to whatever element you want to increase the size of. Then change the size from that.

    Here is an example of what I mean:
    Code:
    <html>
    <head>
    <style type="text/css">
    
    /*Credits: Dynamic Drive CSS Library */
    /*URL: http://www.dynamicdrive.com/style/ */
    
    .suckertreemenu ul{
    margin: 0;
    padding: 0;
    list-style-type: none;
    }
    
    /*Top level list items*/
    .suckertreemenu ul li{
    position: relative;
    display: inline;
    float: left;
    background-color: #F3F3F3; /*overall menu background color*/
    }
    
    /*Top level menu link items style*/
    .suckertreemenu ul li a{
    display: block;
    width: 90px; /*Width of top level menu link items*/
    padding: 1px 8px;
    border: 1px solid black;
    border-left-width: 0;
    text-decoration: none;
    color: navy;
    }
    
    /* Top level menu with for second menu */
    .suckertreemenu #treemenu2 li a {
    width:150px;
    }
    	
    /*1st sub level menu*/
    .suckertreemenu ul li ul{
    left: 0;
    position: absolute;
    top: 1em; /* no need to change, as true value set by script */
    display: block;
    visibility: hidden;
    }
    
    /*Sub level menu list items (undo style from Top level List Items)*/
    .suckertreemenu ul li ul li{
    display: list-item;
    float: none;
    }
    
    /*All subsequent sub menu levels offset after 1st level sub menu */
    .suckertreemenu ul li ul li ul{ 
    left: 159px; /* no need to change, as true value set by script */
    top: 0;
    }
    
    /* Sub level menu links style */
    .suckertreemenu ul li ul li a{
    display: block;
    width: 160px; /*width of sub menu levels*/
    color: navy;
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid #ccc;
    }
    
    .suckertreemenu ul li a:hover{
    background-color: black;
    color: white;
    }
    
    /*Background image for top level menu list links */
    .suckertreemenu .mainfoldericon{
    background: #F3F3F3 url(media/arrow-down.gif) no-repeat center right;
    }
    
    /*Background image for subsequent level menu list links */
    .suckertreemenu .subfoldericon{
    background: #F3F3F3 url(media/arrow-right.gif) no-repeat center right;
    }
    
    * html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
    padding-top: 1em;
    }
    	
    /* Holly Hack for IE \*/
    * html .suckertreemenu ul li { float: left; height: 1%; }
    * html .suckertreemenu ul li a { height: 1%; }
    /* End */
    
    </style>
    
    <script type="text/javascript">
    
    //SuckerTree Horizontal Menu (Sept 14th, 06)
    //By Dynamic Drive: http://www.dynamicdrive.com/style/
    
    var menuids=["treemenu1", "treemenu2"] //Enter id(s) of SuckerTree UL menus, separated by commas
    
    function buildsubmenus_horizontal(){
    for (var i=0; i<menuids.length; i++){
      var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
        for (var t=0; t<ultags.length; t++){
    		if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
    			ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
    			ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
    		}
    		else{ //else if this is a sub level menu (ul)
    		  ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
        	ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
    		}
        ultags[t].parentNode.onmouseover=function(){
        this.getElementsByTagName("ul")[0].style.visibility="visible"
        }
        ultags[t].parentNode.onmouseout=function(){
        this.getElementsByTagName("ul")[0].style.visibility="hidden"
        }
        }
      }
    }
    
    if (window.addEventListener)
    window.addEventListener("load", buildsubmenus_horizontal, false)
    else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus_horizontal)
    
    </script>
    </head>
    <body>
    <h1>First Menu</h1>
    <div class="suckertreemenu">
    	<ul id="treemenu1">
    		<li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    		<li><a href="#">Item 2</a></li>
    		<li><a href="#">Folder 1</a>
    			<ul>
    				<li><a href="#">Sub Item 1.1</a></li>
    				<li><a href="#">Sub Item 1.2</a></li>
    				<li><a href="#">Sub Item 1.3</a></li>
    				<li><a href="#">Sub Item 1.4</a></li>
    			</ul>
    		</li>
    		<li><a href="#">Item 3</a></li>
    		<li><a href="#">Folder 2</a>
    			<ul>
    				<li><a href="#">Sub Item 2.1</a></li>
    				<li><a href="#">Folder 2.1</a>
    					<ul>
    						<li><a href="#">Sub Item 2.1.1</a></li>
    						<li><a href="#">Sub Item 2.1.2</a></li>
    						<li><a href="#">Sub Item 2.1.3</a></li>
    						<li><a href="#">Sub Item 2.1.4</a></li>
    					</ul>
    				</li>
    			</ul>
    		</li>
    		<li><a href="#">Item 4</a></li>
    	</ul>
    <br style="clear: left;" />
    </div>
    
    <br><br><br><br>
    <h1>Second Menu</h1>
    <div class="suckertreemenu">
    	<ul id="treemenu2">
    		<li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    		<li><a href="#">Item 2</a></li>
    		<li><a href="#">Folder 1</a>
    			<ul>
    				<li><a href="#">Sub Item 1.1</a></li>
    				<li><a href="#">Sub Item 1.2</a></li>
    				<li><a href="#">Sub Item 1.3</a></li>
    				<li><a href="#">Sub Item 1.4</a></li>
    			</ul>
    		</li>
    		<li><a href="#">Item 3</a></li>
    		<li><a href="#">Folder 2</a>
    			<ul>
    				<li><a href="#">Sub Item 2.1</a></li>
    				<li><a href="#">Folder 2.1</a>
    					<ul>
    						<li><a href="#">Sub Item 2.1.1</a></li>
    						<li><a href="#">Sub Item 2.1.2</a></li>
    						<li><a href="#">Sub Item 2.1.3</a></li>
    						<li><a href="#">Sub Item 2.1.4</a></li>
    					</ul>
    				</li>
    			</ul>
    		</li>
    		<li><a href="#">Item 4</a></li>
    	</ul>
    <br style="clear: left;" />
    </div>
    
    </body>
    </html>
    The important parts that I added (except for the obvious second menu markup) are highlighted. You'll have to reapply any styling changes you made as well as reset the image paths.

  12. The Following User Says Thank You to Medyman For This Useful Post:

    wiswag (04-17-2008)

  13. #9
    Join Date
    Apr 2008
    Location
    Glasgow, Scotland
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Thanks Medyman, however again no success. Am I making some obvious error I can't see for looking? My code as follows:


    <style type="text/css">

    .suckertreemenu ul{
    margin: 0;
    padding: 0;
    width: 100%;
    list-style-type: none; bold; font-style:normal; font-variant:normal; font-weight:bold; font-size:12px; font-family:Tahoma
    }

    /*Top level list items*/
    .suckertreemenu ul li{
    position: relative;
    display: inline;
    float: left;
    background-color: #2c3169; /*overall menu background color*/
    }

    /*Top level menu link items style*/
    .suckertreemenu ul li a{
    border-left:0px solid white; border-right:1px solid white; border-top:1px solid white; border-bottom:1px solid white; display: block;
    width: 125px; /*Width of top level menu link items*/
    text-decoration: none;
    color: white; padding-left:8px; padding-right:8px; padding-top:1px; padding-bottom:1px
    }

    /* Top level menu with for second menu */
    .suckertreemenu #treemenu2 li a {
    width:126px;
    }

    /*1st sub level menu*/
    .suckertreemenu ul li ul{
    left: 0;
    position: absolute;
    top: 1em; /* no need to change, as true value set by script */
    display: block;
    visibility: hidden;
    }

    /*Sub level menu list items (undo style from Top level List Items)*/
    .suckertreemenu ul li ul li{
    display: list-item;
    float: none;
    }

    /*All subsequent sub menu levels offset after 1st level sub menu */
    .suckertreemenu ul li ul li ul{
    left: 130px; /* no need to change, as true value set by script */
    top: 0;
    }

    /* Sub level menu links style */
    .suckertreemenu ul li ul li a{
    display: block;
    width: 125px; /*width of sub menu levels*/
    color: white;
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid #ccc;
    }

    .suckertreemenu ul li a:hover{
    background-color: #008080;
    color: white;
    }

    /*Background image for top level menu list links */
    .suckertreemenu .mainfoldericon{
    background: #2c3169 url('media/arrow-down.gif') no-repeat center right;
    }

    /*Background image for subsequent level menu list links */
    .suckertreemenu .subfoldericon{
    background: #2c3169 url('media/arrow-right.gif') no-repeat center right;
    }

    * html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
    padding-top: 2em;
    }

    /* Holly Hack for IE \*/
    * html .suckertreemenu ul li { float: left; height: 1%;}
    * html .suckertreemenu ul li a { height: 1%;}
    * html .suckertreemenu ul li ul li { float: left;}
    * html .suckertreemenu ul li ul li a{ margin-top:-2px;
    /* End */

    </style>

    <script type="text/javascript">

    var menuids=["treemenu1","treemenu2"] //Enter id(s) of SuckerTree UL menus, separated by commas

    function buildsubmenus_horizontal(){
    for (var i=0; i<menuids.length; i++){
    var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
    ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
    ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
    }
    else{ //else if this is a sub level menu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
    }
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
    }
    }

    if (window.addEventListener)
    window.addEventListener("load", buildsubmenus_horizontal, false)
    else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus_horizontal)

    </script>

    </style>

    </head>

    <body>

    **////HtmlCode 1st menu////**


    <div class="suckertreemenu" align="center">
    <ul id="treemenu1">
    <li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Folder 1</a>
    <ul>
    <li><a href="#">Sub Item 1.1</a></li>
    <li><a href="#">Sub Item 1.2</a></li>
    <li><a href="#">Sub Item 1.3</a></li>
    <li><a href="#">Sub Item 1.4</a></li>
    </ul>
    </li>
    <li><a href="#">Item 3</a></li>
    <li><a href="#">Folder 2</a>
    <ul>
    <li><a href="#">Sub Item 2.1</a></li>
    <li><a href="#">Folder 2.1</a>
    <ul>
    <li><a href="#">Sub Item 2.1.1</a></li>
    <li><a href="#">Sub Item 2.1.2</a></li>
    <li><a href="#">Sub Item 2.1.3</a></li>
    <li><a href="#">Sub Item 2.1.4</a></li>
    </ul>
    </li>
    </ul>
    </a>
    </li>
    <li><a href="#">Item 4</a></li>
    </ul>
    <br style="clear: left;" />
    </div>

    **////HtmlCode 2nd menu////**

    <div class="suckertreemenu" align="center">
    <ul id="treemenu2">
    <li><a href="#" style="border-left: 1px solid black">Name 1</a></li>
    <li><a href="#">Name 2</a></li>
    <li><a href="#">Name 3</a></li>
    <li><a href="#">Name 4</a></li>
    <li><a href="#">Name 5</a></li>
    <li><a href="#">Name 6</a></li>
    </ul>
    <br style="clear: left;" />
    </div>

    </body>

    </html>

  14. #10
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Do you want a hover effect for the last one? If you do, I don't think that your doing it right, you didn't include the hover stuff, in the case, it won't show.
    Hope this Helps,
    Nile
    Jeremy | jfein.net

  15. The Following User Says Thank You to Nile For This Useful Post:

    wiswag (04-26-2008)

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
  •