[jQuery] collapsible menus ~ pixel carnage
discovered collapsible menu tutorial by pixel carnage. Got it working all
except for the fact that if I wrap the Expand/Collapse link with <h3> (for
styling purposes) the expan/collap fails...
Heres the tutorial by PixelCarnage:
http://pixelcarnage.net/articles/development/jquery-collapsible-menu/
Very straightforward & I tried to modify the javascript to handle the
surrounding h3 but to no avail!
My code so far:
<ul id="Menu">
<li id="current_cat"><h3> # Accessories </h3>
<ul>
<li> sub menu links</li>
<li> sub menu links</li>
<li> sub menu links</li>
<li> sub menu links</li>
<li> sub menu links</li>
</ul>
</li>
========== THE JAVA SCRIPT ==============
$("#Menu > li > h3 > a + ul").attr("slide", "down");
// Collapse everything but the first menu:
$("#Menu > li > h3 > a").not(":first").find("+
ul").slideUp(1).attr("slide", "up");
// Expand or collapse:
$("#Menu > li > h3 > a").click(function() {
// Collapse open menu:
$(this).find("#Menu > li > h3 > a +
ul[@slide='down']").slideUp("fast").attr("slide", "up");
// Expand this menu:
$(this).find("+ ul").slideToggle("fast").attr("slide", "down");
});
--
View this message in context: http://www.nabble.com/collapsible-menus-%7E-pixel-carnage-tf3256095.html#a9052548
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/