Cheok Yan Cheng
Cheok Yan Cheng

Reputation: 42642

Javascript DropDown Menu

I was looking to implement such menu as

http://www.fogcreek.com/FogBugz/learnmore.html (Left hand side)

Can anyone recommence some plug-in for jquery, or any other JavaScript library which behave same as above site?

Upvotes: 1

Views: 331

Answers (4)

Cheok Yan Cheng
Cheok Yan Cheng

Reputation: 42642

I had tried the jquery plug-in, it doesn't fit my requirement.

However, I am able to make it works, by copying JS and CSS from other sites :

http://jstock.sourceforge.net/features.html

Upvotes: 0

Randell
Randell

Reputation: 6170

jQuery Accordion does that.

You can use this code (from the jQuery Accordion page) to try it out:

Head:

<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.accordion.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#accordion").accordion();
});
</script>

Body:

<div id="accordion">
    <h3><a href="#">Section 1</a></h3>
    <div>Mauris mauris ante</div>
    <h3><a href="#">Section 2</a></h3>
    <div>Sed non urna</div>
    <h3><a href="#">Section 3</a></h3>
    <div>Nam enim risus </div>
    <h3><a href="#">Section 4</a></h3>
    <div>Cras dictum</div>
</div>

Upvotes: 1

Macha
Macha

Reputation: 14654

Using jQuery, I have this script which I use:

$(document).ready(function() {
    $(".nav > li > a").click(function() {
        $("ul", $(this).parent()).slideToggle("normal");
        return false;
    });
    $(".nav ul").hide(); // Hide all on load. Done here rather than in CSS so users
    // see the menu if they have javascript disabled.
});

The menu is marked up in HTML as:

<ul class="nav">
     <li><a href="#">Header</a></li>
     <li>
          <ul>
              <li>Sub list Items</li>
              <!-- More -->
          </ul>
     </li>
 </ul>

for each expandable section.

Upvotes: 1

Related Questions