Skip navigation
Currently Being Moderated

CSS Dynamic Collapsible Menu Issues

Jun 19, 2012 2:05 AM

Tags: #css #menu #menu-problems

Hello all

 

I am struggling with creating a vertical inline collapsible menu for a site. I have had two attempts at changing the current CSS myself, adapting templates I have found but none have the desired result, where can I find additional CSS info to achieve what I need and where to input it as I have never done any CSS/HTML work before starting this job a few week ago! The menu as it appears now is correct and I have placed the correct pages as sub-menus by dragging and dropping the pages onto the correct link on the menu to create the nest/parent folder (is that the right term?) but need to adapt the stylesheet to recognise it. The submenus are disabled at the moment as the appear on top of the original menu. Current CSS looks like this (before my attempts):

 

/* Dynamic menu */

#navigation ul {

list-style-type: none;

margin-left:-5px;

padding:0px;

width:200px;

}

#navigation li a {

font-family: helvetica, arial, sans-serif;

text-indent: 12px;

font-size: 13px;

line-height: 18px;

color: white;

text-decoration:none;

color: #fff;

cursor: pointer;

display:block;

height:25px;

line-height: 25px;                  

width:100%;

}

#navigation li a:hover {

background-image: url(/images/navbg.jpg);

        background-repeat: no-repeat;

}

 

Thanks in advance.

 
Replies
  • Currently Being Moderated
    Jun 25, 2012 8:06 AM   in reply to matt_no7

    Matt,

     

    not sure what exactly you are hoping for design-wise (include a link?), but this might help you out:

     

    /* Dynamic menu */

     

    #navigation ul {

        list-style-type: none;

        margin: 0;

        padding: 0px;

        width: 200px;

    }

    #navigation li {

        position: relative;

    }

    #navigation li a {

        font-family: helvetica, arial, sans-serif;

        text-indent: 12px;

        font-size: 13px;

        line-height: 18px;

        color: white;

        text-decoration: none;

        color: #fff;

        cursor: pointer;

        display: block;

        height: 25px;

        line-height: 25px;

        width: 100%;

        background: #333;

       

        position: relative;

    }

    #navigation li ul {

        left: -999em;

        position: absolute;

    }

    #navigation li a:hover {

        background: #666;

    }

    #navigation li:hover > ul {

        left: 200px;

        position: absolute;

        top: 0;

    }

     

    Nicole - BCGurus.com   |  http://bcgurus.com/Business-Catalyst-Templates for only $7

     
    |
    Mark as:
  • Liam Dilley
    4,232 posts
    Feb 28, 2012
    Currently Being Moderated
    Jul 5, 2012 6:09 AM   in reply to matt_no7

    This any help to you to get to grips with things?

    http://forums.adobe.com/docs/DOC-1903

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 9:33 AM   in reply to matt_no7

    Hello matt_no7,

    The css that Nicole gave you was for a drop down style menu that drops below or to the side of your menu. She didn't have all the info needed, so for the collapsing menu this will not work.

     

    To get this to work all you would need to do is set the second unordered list to display none, then use jQuery to toggleSlide when the top level link is clicked.

     

    Here is a jsfiddle that uses some of the code from your example site: http://jsfiddle.net/chaddidthis/swArc/4/

     

    So basically set the second level unordered lists to display none:

     

    #nav ul ul{      display:none; }

     

    Then the jQuery to toggle them up and down:

     

    $("#nav ul li a").click(function(e) {         e.preventDefault();         $(this).siblings("ul").slideToggle("fast");     });

     

    The jQuery needs to be in a ready function and inside script tags.

     

    All of the css above this, with the absolute positioning and left -999ems, that isn't necessary and you can get rid of most of that.

     

    Hope this helps,

    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 9:37 AM   in reply to Chad - BCGurus.com

    I have also had issues with code not updating when I save and re-upload css files.  Don't know if it is a BC thing or what. Seems to update eventually, but takes a long time.

     

    Hope this helps,

    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

     
    |
    Mark as:
  • Liam Dilley
    4,232 posts
    Feb 28, 2012
    Currently Being Moderated
    Jul 5, 2012 12:58 PM   in reply to Chad - BCGurus.com

    It is that caching bug that appears often after releases etc. You probably seen it over the years more then once :)

     

    Often it is the media server out of sync of the system server. As you probably know things like the CSS etc is not all in the same place as the system stuff and BC serves cached versions for performance. When you upload new files the cache is supposed to be flushed as it were and the a new cache file generated.

    That's a bit laments terms for everyone so not 100% accurate but you get the idea and get to see what possible issues can occur.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2012 6:53 AM   in reply to matt_no7

    Hello matt_no7,

    To use the jQuery provided, place the jQuery from my jsfiddle link between script tags:

     

    <script type="text/javascript">

    //code goes here//

    </script>

     

    Then wrap your dynamic menu in a div with an ID of nav:

     

    <div id="nav">

    {module_menu,XXXXXX}

    </div>

     

    or if your menu is already wraped by a div you can just change the jQuery to match.

     

    Hope this helps,

    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 9, 2012 2:26 PM   in reply to matt_no7

    Right, so you got the drop down style menu working. To get the collapsable menu you don't need to edit your dynamic menu other than "Quarsh Services" will not be a link to a page any longer, because you want it to show the other links when you click it - not go to a page.

     

    Then just place the js on the template using the script tags and the code from jsfiddle. I would place it on the bottom of the page, just above the </body> tag, you will also need to add jQuery to your page - here is a CDN link:

     

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

     


    Hope this helps,

    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points