Skip navigation
dandolino
Currently Being Moderated

Simple Collapsible Menu using Dreamweaver Tutorial

Dec 22, 2010 8:05 PM

If you're interested in a tutorial for a simple Collapsible Menu using Dreamweaver, I put together some jquery code to make a regular nested list turn into a collapsible list.  Very easy to follow with images illustrating the steps. Tested for all main browsers, include IE6.

 

http://webdesigndan.com/blog/collapsible-menu

 

 

As opposed to Spry Collapsible Panel,  this is very lightweight and has no css... So design from scratch... Good Luck.

 

Dan Czyzyk

 
Replies
  • Currently Being Moderated
    Dec 23, 2010 12:18 AM   in reply to dandolino

    dandolino wrote:

     

    If you're interested in a tutorial for a simple Collapsible Menu using Dreamweaver, I put together some jquery code to make a regular nested list turn into a collapsible list.  Very easy to follow with images illustrating the steps. Tested for all main browsers, include IE6.

     

    http://webdesigndan.com/blog/collapsible-menu

     

     

    As opposed to Spry Collapsible Panel,  this is very lightweight and has no css... So design from scratch... Good Luck.

     

    Dan Czyzyk

     

    Hi Dan,

     

    Looks useful. Someone on here yesterday could have done with that solution.

     

    One thing, for those that don't know, it might be a good idea to provide a download link to the jquery script which is needed. The following opening line of the tutorial might just be enough to 'confuse' people:

     

    'Paste the jquery core and internal js script into the head of your webpage'

     

    It's simple for most that know how to get at the scripts BUT for those that don't it can be a big obstacle and ruin a perfectly good tutorial.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2010 12:53 PM   in reply to dandolino

    In addition to what Osgood already mentioned about the JS library,  modern site developers are urged to use Google's Libraries API -- a content distribution network and loading architecture for the most popular, open-source JavaScripts including jQuery, MooTools, Yahoo UI and others.

     

    http://code.google.com/apis/libraries/devguide.html

     

    By loading or linking to Google hosted scripts, you don't need to download the physical file and host it on your server. Also since most people have recently visited a site that uses scripts from Google, they're likely to have it in their cache which speeds up web performance for everyone.

     

     

     

    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 23, 2011 7:27 AM   in reply to dandolino

    I tried this menu script,, but for some reason it does not work in my page.

    Wehn I view my page in ie6, the sub menus are not in place and don't fold.

    Everything is in place, css js file etc.,...

    Probally the code is in conflict with the rest of my code ??

    I noticed that, when I remove the " <link type="text/css" href="css/default.css" rel="stylesheet" media="screen" />"

    the menu works, but the complete layout of my page get destroyed.

     

    Here is head code of my page, I hope someone can help me with this,?

    I already spent so many time on it.

    code :

    ------------------------------------------------------------

    <head>
    <!--Built by Dan Czyzyk - Free to Use -->
      <link type="text/css" href="css/default.css" rel="stylesheet" media="screen" />
       <script type="text/javascript" src="js/jquery-1.4.4.js"></script>
       <script type="text/javascript" src="js/collapsible.js"></script>
        <script type="text/javascript">
              var dropCount = 1;
                $("document").ready (function(){
               $("li[class^='dropTarget']").each(function(){
                   $(".dropTarget"+ dropCount +" > a").attr("id", "dropATarget"+dropCount );
                   $(".dropTarget"+ dropCount +" > ul").attr("id", "dropMenu"+dropCount );
                   $("#dropMenu"+dropCount).hide();
                   dropCount++;
               });
          });
          
          $(function(){
               $("a[id^='dropATarget']").click(function(){
                   $(this).next().slideToggle("normal");
               });
           });
        </script>

    <style type="text/css">
    .dropTarget1, .dropTarget2,  .dropTarget3,  .dropTarget4,  .dropTarget5,  .dropTarget6,  .dropTarget7,  .dropTarget8,  .dropTarget9,  .dropTarget10,  .dropTarget11,  .dropTarget12,  .dropTarget13,  .dropTarget14, .dropTarget15 {}
    </style>
    <title>blabla</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />
    <script src="js/html5.js"></script>
    <script src="js/jquery.js"></script>
    <script src="js/effects.core.js"></script>
    <script src="js/effects.slide.js"></script>
    <script src="js/supersized.2.0.js"></script>
    <script src="js/supersized.js"></script>
    <script src="js/pause.js"></script>
    <script src="js/custom.js"></script>
    <script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
    <script>
    $(document).ready(function(){
    sluiten();
    $('#tekst').wait(5000).fadeIn();
    });
    $(function() {
    $('a.lightbox').lightBox(); // Select all links with lightbox class
    });
    </script>
    </head>

    ---------------------------------------------------------------

     

    THANKS for the help !!!

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 11:56 AM   in reply to dandolino

    Neat Dan! Would this work well for mobile? I'm so confused as to the best type of menus for mobile-friendly design. Any suggestions? I need them to provide the functionality of drop-downs... thanks! Anyone out there with suggestions, I'd sure appreciate it!

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2011 12:37 PM   in reply to dandolino

    Sure! http://www.duenorthdesign.com/pcm

    The menu would be located just to the right of the "virtual bank" graphic. This is not really a mobile-friendly design (especially with the xtra nav on the left), that is a whole different subject I need to figure out. But I do want to know what is the BEST method. In the past I"ve made drop-down menus in fireworks, but I  know there are full CSS menus - I just don't want to have issues! thanks much!

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2011 6:25 AM   in reply to dandolino

    Hi Dan,

     

    Sorry for the late reply (just back in town).

     

    Here is the link :

    http://www.kameleonweb.be/clients/lambrechts-nicolaers/index_stripped. html#

     

    The menu does not fold out at the right location; it seems as if the code is in conflict with other css code ??

     

    Thanks for the help !

     

    Erwin

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2011 9:05 AM   in reply to Renzo12345

    Renzo12345 wrote:

     

    Hi Dan,

     

    Sorry for the late reply (just back in town).

     

    Here is the link :

    http://www.kameleonweb.be/clients/lambrechts-nicolaers/index_stripped. html#

     

    The menu does not fold out at the right location; it seems as if the code is in conflict with other css code ??

     

    Thanks for the help !

     

    Erwin

     

    Amend your menu css selectors as follows: (but first make a back-up of the css file just incase you need to revert to the orginal)

     

    #menu{
        width:200px;
        background:white;
        min-height: 100%;
        position: absolute;
        left: 40px;

         top: 0;
          padding: 150px 0 0 30px;
    }
    #menu ul{
        list-style:none;
        width:160px
    }
    #menu ul li{
        line-height:25px;
    }

     

    You should find that the submenus now drop down at the correct location HOWEVER they don't stay open for long which is as a result of your collapsible.js file which is obviously conflicting with the workings.

     

    <script type="text/javascript" src="js/collapsible.js"></script>

     

    Comment it out in your code (as shown below) and you'll see the menu works correctly.

     

    <!-- <script type="text/javascript" src="js/collapsible.js"></script>-->

     

     

    As an aside note the use of Absolute Positioning <div> is not a recommended method. They should only be used in special circumstances not as the main construction of a page.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2011 9:15 AM   in reply to osgood_

    Hi Dan,

     

    I adjusted the css file, and yes, this works !

    You say that  the menu does not stay open for long, but, I can't see

    this problem (tested on Firefox and IE).

    Can you be a litlle bit more precise when this happens,

     

    thanks,

     

    Erwin

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2011 10:03 AM   in reply to Renzo12345

    Renzo12345 wrote:

     

    Hi Dan,

     

    I adjusted the css file, and yes, this works !

    You say that  the menu does not stay open for long, but, I can't see

    this problem (tested on Firefox and IE).

    Can you be a litlle bit more precise when this happens,

     

    thanks,

     

    Erwin

     

    I'm not Dan but never mind, I've been called worse

     

    If I test the menu in Firefox when the collapsible.js script is live (linked) the submenus just open and close quickly therefore you are not able to select the submenus.

     

    If you have tested and it works then fine, it might be a Firefox browser issue although I can't imagine it could be. I'm going to test in Safari and see what happens.

     

    Same issue in Safari - the submenus slide open and then slide shut again making it impossible to select any link in the submenus. I'm testing on a Mac by the way

     

    If I deactivate the collapisble.js script everything works as it should.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 1:41 PM   in reply to dandolino

    Thanks for this - it's really fantastic!

    Just one question, is there any way to collapse a previously opened submenu when a new menu item is selected? I only want one sub menu revealed at a time.

    Thank you!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)