Skip to content

Instantly share code, notes, and snippets.

@rc1
Created March 2, 2011 18:02
Show Gist options
  • Select an option

  • Save rc1/851379 to your computer and use it in GitHub Desktop.

Select an option

Save rc1/851379 to your computer and use it in GitHub Desktop.
One open at a time
/* Expanding Menus for Indexhibit
* uses jquery
*
* -- Version: One open at a time --
*
* Created by RossCairns.com
*/
var last;
function expandingMenu(num) {
var speed = 500;
var item_title = $("#menu ul").eq(num).children(":first");
var items = $("#menu ul").eq(num).children().filter(function (index) { return index > 0; });
/* hide items if not active */
if (items.is(".active") == false) {
items.hide();
}
/* add click functions + pointer to title */
item_title.css({cursor:"pointer"}).click(
function () {
items.show(speed);
if (last != undefined && last != items) {
last.hide(speed);
}
last = items;
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment