collapsor:
/*
* collapsor (1.0) // 2008.04.05 // <http://plugins.jquery.com/project/collapsor>
*
* REQUIRES jQuery 1.1.2+ <http://jquery.com/>
*
* Copyright (c) 2008 TrafficBroker <http://www.trafficbroker.co.uk>
* Licensed under GPL and MIT licenses
*
* collapsor opens and closes sublevel elements, like a collapsable menu
*
* We need to select the clickable elements that trigger the opening action of the sublevels: $('#menu ul li a').collapsor();
* The sublevel element must be in the same level than the triggers
*
* Sample Configuration:
* $('ul a').collapsor();
*
* Config Options:
* activeClass: Class added to the element when is active // Default: 'active'
* openClass: Class added to the element when is open // Default: 'open'
* sublevelElement: Element that must open or close // Default: 'ul'
* speed: Speed for the opening animation // Default: 500
* easing: Easing for the opening animation. Other than 'swing' or 'linear' must be provided by plugin // Default: 'swing'
*
* We can override the defaults with:
* $.fn.collapsor.defaults.speed = 1000;
*
* @param settings An object with configuration options
* @author Jesus Carrera <jesus.carrera@trafficbroker.co.uk>
*/
collapsor samples:
HTML:
<ul>
<li>
<a href="#menu_1">Menu 1</a>
<ul>
<li>
<a href="#menu_1_1">Menu 1-1</a>
</li>
<li>
<a href="#menu_1_2">Menu 1-2</a>
<ul>
<li>
<a href="#menu_1_2_1">Menu 1-2-1</a>
</li>
<li>
<a href="#menu_1_2_2">Menu 1-2-2</a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#menu_2">Menu 2</a>
</li>
<li>
<a href="#menu_3">Menu 3</a>
</li>
</ul>
JS:
$('ul a').collapsor();
HTML:
<dl>
<dt>
Level 1
</dt>
<dd>
Level 1 desc
</dd>
<dt>
Level 2
</dt>
<dd>
<strong>Level 2 desc</strong>
<dl>
<dt>
Sublevel 1
</dt>
<dd>
Sublevel 1 desc
</dd>
</dl>
</dd>
</dl>
JS:
$('dl strong').collapsor({sublevelElement:'dl', speed: 1000});
-
Level 1
-
Level 1 desc
-
Level 2
-
Level 2 desc
-
Sublevel 1
-
Sublevel 1 desc