Have tried, tried and tried - how do I add an extra level to this menu

12 replies
  • WEB DESIGN
  • |
Hi,

I've tried to add an extra level to the menu at www.contest.dk, under IT-services > IT-sikkerhed.
Here I would like to add an extra element, so it becomes IT-services > IT-sikkerhed > NewItem.

I believe I just need to add some CSS code to handle this 3rd level, but I haven't figured out what yet.

Can you help?

Thanks a lot.

Best regards,
Thomas
#add #extra #level #menu
  • Profile picture of the author mahesh2010
    Hi,
    I cant access the url you have provided
    can you just put the code over here so that we can give some good solution
    code is both html and Css code
    {{ DiscussionBoard.errors[3646337].message }}
  • Profile picture of the author ThomasTe
    Hi mahesh2010,

    You can try Contest A/S - IT-infrastruktur, -sikkerhed, -drift, og -udvikling.

    Here's the css code:

    <style>

    /* These styles create the dropdown menus. */
    #navbar {
    margin: 0;
    padding: 0;
    float:none;
    height: 1em; }
    #navbar li {
    list-style: none;
    width:170px;
    float: left; }
    #navbar li a {
    display: block;
    padding: 3px 8px;
    background-color: #808080;
    text-align: left;
    color: #fff;
    text-decoration: none; }
    #navbar li ul {
    display: none;
    width: 171px; /* Width to help Opera out */
    background-color: #808080;}
    #navbar li:hover ul, #navbar li.hover ul {
    display: block;
    position: absolute;
    margin: 0;
    padding: 0; }
    #navbar li:hover li, #navbar li.hover li {
    float: none; }
    #navbar li:hover li a, #navbar li.hover li a {
    background-color: #808080;
    color: #fff; }
    #navbar li a:hover {
    background-color: #C0C0C0; }
    #navbar li li a:hover {
    background-color: #C0C0C0; }
    .auto-style2 {
    font-family: Verdana;
    font-size: 9pt;
    }
    .auto-style3 {
    color: #666666;
    }
    </style>

    <script>
    // Javascript originally by Patrick Griffiths and Dan Webb.
    // Son of Suckerfish Dropdowns | HTML Dog
    sfHover = function() {
    var sfEls = document.getElementById("navbar").getElementsByTag Name("li");
    for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
    this.className+=" hover";
    }
    sfEls[i].onmouseout=function() {
    this.className=this.className.replace(new RegExp(" hover\b"), "");
    }
    }
    }
    if (window.attachEvent) window.attachEvent("onload", sfHover);
    </script>
    Here's the html code (it's in a table):

    <div align="center">
    <table border="0" width="100%" cellspacing="0" cellpadding="3" bgcolor="#808080">
    <tr>
    <td align="center">
    <table align="center" cellpadding="0" cellspacing="0" style="width: 1024px">
    <tr>
    <td>
    <ul id="navbar" style="width: 1030px">
    <!-- The strange spacing herein prevents an IE6 whitespace bug. -->
    <li><span class="auto-style2"><a title="Contest A/S" href="http://www.contest.dk"><strong>Start...ong></a></span>
    </li>
    <li><span class="auto-style2"><a title="Contest A/S firmaprofil" href="http://www.contest.dk/firmaprofil.as...ong></a></span>
    </li>
    <li><span class="auto-style2"><a title="Contest A/S IT-services"href="http://www.contest.dk/it-services.as...ong></a></span>
    <ul>
    <li><span class="auto-style2"><a title="IT-infrastruktur" href="http://www.contest.dk/it-infrastrukt.../a></span></li>
    <li><span class="auto-style2"><a title="IT-sikkerhed" href="http://www.contest.dk/it-sikkerhed.a.../a></span></li>
    <li><span class="auto-style2"><a title="IT-drift og IT-service" href="http://www.contest.dk/it-drift-og-it...p"><b>IT-drift og IT-service</b></a></span></li>
    <li><span class="auto-style2"><a title="IT-udvikling" href="http://www.contest.dk/it-udvikling.a.../a></span></li>
    </ul>
    </li>
    <li><span class="auto-style2"><a title="Produktartikler" href="http://www.contest.dk/produktartikle...ong></a></span>
    </li>
    <li><span class="auto-style2"><a title="Kontakt"href="http://www.contest.dk/kontakt.asp"><...ong></a></span>
    </li>
    <li><span class="auto-style2"><a title="Nyhedsbrev"href="http://www.contest.dk/nyhedsbrev.asp...ong></a></span>
    </li>
    </ul>

    </td>
    </tr>
    </table>

    </td>
    </tr>
    </table>
    </div>
    Note, in the html code I have not added the third level, since I could not figure out how to do it.

    Thanks alot for taking the time.

    Best regards,
    Thomas
    {{ DiscussionBoard.errors[3646863].message }}
  • Profile picture of the author crushthenet
    Typically menus are unordered lists nested in line items or LI's.

    See how your code starts here... Your first UL
    Code:
    <ul id="navbar" style="width: 1030px">
    Starting Unordered list. Then you have line items in that so it looks like this...
    Code:
    <ul>
    <li>link</li>
    <li>link</li>
    </ul>
    Then you can see your first nested UL... It starts before the line item ends
    Code:
    <li><span class="auto-style2"><a title="Contest A/S IT-services"href="http://www.contest.dk/it-services.as...ong></a></span>
              <ul>
    See how the LI doesn't end after the span (above), the UL starts immediately. So what you want to do is this.......
    Take this part...

    Code:
    <li><span class="auto-style2"><a title="IT-sikkerhed" href="http://www.contest.dk/it-sikkerhed.a.../a></span></li>
    And nest a UL in it, kind of like this...
    Code:
    <li><span class="auto-style2"><a title="IT-sikkerhed" href="http://www.contest.dk/it-sikkerhed.a.../a></span>
    
    <ul>
    <li>nested inside</li>
    </ul>
    
    </li>

    So you're nesting a UL inside of the line item you want it to show under, then you just have to modify using CSS so it looks right.

    Sorry if this isn't super easy or clear, working with menus is a bit difficult sometimes.
    Signature
    Video Background Music :: Royalty Free Background Music for Just About Anything! 50 Tracks for just $17...
    My Personal Blog :: The Calaboratory
    {{ DiscussionBoard.errors[3648473].message }}
  • Profile picture of the author ThomasTe
    Thanks, crushthenet.
    However, the issue seems to rise when I add the third level UL.
    I think it's because the CSS is not set up to handle it. Any input on that part?

    Thanks.

    Best regards,
    Thomas
    {{ DiscussionBoard.errors[3652411].message }}
  • Profile picture of the author ThomasTe
    Any input on the CSS?

    Thanks.

    BR,
    Thomas
    {{ DiscussionBoard.errors[3670633].message }}
  • Profile picture of the author xtrapunch
    Why the hell experts are for? Go and directly ask them for help rather than wasting time and effort.
    Signature
    >> Web Design, Wordpress & SEO - XtraPunch.com <<
    Web Design & SEO Agency | Serving World Wide from New Delhi, India

    {{ DiscussionBoard.errors[3670737].message }}
  • Profile picture of the author Evan-M
    .nav-container-outer{
    position:absolute;
    z-index:1;
    padding: 0px;
    height: 25px;

    }

    .float-left{
    float: left;
    }
    .float-right{
    float: right;
    }


    .nav-container .divider{
    display:block;
    font-size:1px;
    border-width:0px;
    border-style:solid;

    }


    .nav-container .divider-vert{
    float:left;
    width:0px;
    display: none;

    }
    .nav-container .item-secondary-title{
    display:block;
    cursor:default;
    white-space:nowrap;
    }

    .clear{
    font-size:1px;
    height:0px;
    width:0px;
    clear:left;
    line-height:0px;
    display:block;
    float:none;
    }


    .nav-container{
    position:relative;
    zoom:1;
    margin: 0 auto;
    float: left;

    }
    .nav-container a, .nav-container li{
    float:left;
    display:block;
    white-space:nowrap;
    }
    .nav-container div a, .nav-container ul a, .nav-container ul li{
    float:none;
    }
    .nav-container ul{
    left:-10000px;
    position:absolute;
    }
    .nav-container, .nav-container ul{
    list-style:none;
    padding:0px;
    margin:0px;
    }
    .nav-container li a{
    float:none
    }
    .nav-container li{
    position:relative;
    }
    .nav-container ul{
    z-index:10;
    }
    .nav-container ul ul{
    z-index:20;
    }
    .nav-container ul ul ul{
    z-index:30;
    }
    .nav-container ul ul ul ul{
    z-index:40;
    }
    .nav-container ul ul ul ul ul{
    z-index:50;
    }
    li:hover>ul{
    left:auto;
    }
    #nav-container ul {
    top:100%;
    }
    #nav-container ul li:hover>ul{
    top:0px;
    left:100%;
    }

    /*^'^ Primary Items ^'^*/
    #nav-container a{
    padding:0px 4px 7px 2px;
    margin: 1px 0px 0px 0px;
    color: #FFF;
    font-family: Trebuchet MS, Arial, sans-serif, Helvetica;
    font-size:1.2em;
    text-decoration:none;
    font-weight: bold;
    background-repeat: no-repeat;
    background-position: top;
    }

    #nav-container a:hover{
    color: #FF0000;

    background-repeat: no-repeat;
    background-position: center;
    }

    /*^'^ Secondary Items Container ^'^*/
    #nav-container div, #nav-container ul{
    padding:3px 4px 0px 4px;
    margin:0px 0px 0px 0px;
    background-repeat: repeat-x;
    background-color: #000;
    border-bottom: 1px solid #000;
    }

    /*^'^ Secondary Items ^'^*/
    #nav-container div a, #nav-container ul a{
    padding:3px 10px 3px 6px;

    background-repeat: no-repeat;
    background-position: 0px 22px;
    font-size:1.2em;
    border-width:0px;
    border-style:none;
    margin: 0px 0px 0px 0px;
    width: 149px;
    }

    /*^'^ Secondary Items Hover State ^'^*/
    #nav-container div a:hover, #nav-container ul a:hover{
    background-repeat: no-repeat;
    color:#ff9600;
    }

    /*^'^ Secondary Item Titles ^'^*/
    #nav-container .item-secondary-title{
    cursor:default;
    padding:4px 0px 3px 7px;
    color: #000;
    font-family: Arial, Trebuchet MS, Arial, sans-serif, Helvetica;
    font-size:12px;
    font-weight:bold;
    }

    /*^'^ Horizontal Dividers ^'^*/
    #nav-container .divider-horiz{
    border-top-width:1px;
    margin:5px 5px;
    border-color: #152066;
    }

    /*^'^ Vertical Dividers ^'^*/
    #nav-container .divider-vert{
    border-left-width:1px;
    height:15px;
    margin:4px 2px 0px 2px;
    border-color:#AAAAAA;
    }

    /* CSS for testimonials */
    #sfstest-sidebar blockquote { padding: 2px; }
    #sfstest-sidebar cite { font-style: italic; }
    #sfstest-page blockquote { padding: 10px; }
    #sfstest-page cite { font-style: italic; }
    #sfstest-sidebar .sfststreadmore { text-align: center; margin-top: 5px; }

    #sfstest-page .align-right { float:right; margin: 0 0 5px 5px; }
    #sfstest-page .align-left { float:left; margin: 0 5px 5px 0; }






    also create a a container div to put the menu in, and control it. you may need to adjust the code a bit, but i think its close to what you need ( need some color/font adjustments)




    then

    <div class="container">
    <div class="nav-container-outer">
    <ul id="nav-container" class="nav-container">

    <li><span class="divider divider-vert" ></span></li>
    <li><a class="item-primary" href="#">title here</a>
    <ul style="width:185px;">
    <li><a href="#">link</a></li>

    <li><a class="item-primary" href="#">title here</a>
    <ul style="width:185px;">
    <li><a href="#">link</a></li>
    </li>
    </ul>

    </li>
    </ul>

    </div>
    </div>



    That Should Do What You Need
    Signature

    Evan-M

    Easily The Worlds Best Wordpress Popup plugin

    Visit Website Design Firm For All Your Wordpress Coding Needs

    {{ DiscussionBoard.errors[3671634].message }}
  • Profile picture of the author SteveJohnson
    Thomas - the original Suckerfish menu that you're basing yours from includes nesting 2 levels deep, and instructions for taking it even beyond that. The CSS is all there in the original, just copy/paste and tweak.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[3672284].message }}
  • Profile picture of the author ThomasTe
    @Evan: Thanks alot, I will check that out and let you know.

    @Steve: Thanks, Steve. I'm not sure which css elements to add, to handle the third level?

    Best regards,
    Thomas
    {{ DiscussionBoard.errors[3685179].message }}
  • Profile picture of the author ThomasTe
    @Evan, the code only seems to show one level.

    BR,
    Thomas
    {{ DiscussionBoard.errors[3685197].message }}
    • Profile picture of the author Evan-M
      Originally Posted by ThomasTe View Post

      @Evan, the code only seems to show one level.

      BR,
      Thomas
      hrm, you must be leaving something out, just tried the code i sent and the original menu, and both went more than one level on my end?
      Signature

      Evan-M

      Easily The Worlds Best Wordpress Popup plugin

      Visit Website Design Firm For All Your Wordpress Coding Needs

      {{ DiscussionBoard.errors[3685558].message }}
  • Profile picture of the author ThomasTe
    @Evan, Tried again and still get the same result.

    Thanks for taking the time though.

    Best regards,
    Thomas
    {{ DiscussionBoard.errors[3704136].message }}

Trending Topics