/* * Accordion 1.5 - jQuery menu widget * * Copyright (c) 2007 Jörn Zaefferer, Frank Marcia * * http://bassistance.de/jquery-plugins/jquery-plugin-accordion/ * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Revision: $Id: jquery.accordion.js 2880 2007-08-24 21:44:37Z joern.zaefferer $ * */ /** * Make the selected elements Accordion widgets. * * Semantic requirements: * * If the structure of your container is flat with unique * tags for header and content elements, eg. a definition list * (dl > dt + dd), you don't have to specify any options at * all. * * If your structure uses the same elements for header and * content or uses some kind of nested structure, you have to * specify the header elements, eg. via class, see the second example. * * Use activate(Number) to change the active content programmatically. * * A change event is triggered everytime the accordion changes. Apart from * the event object, all arguments are jQuery objects. * Arguments: event, newHeader, oldHeader, newContent, oldContent * * @example jQuery('#nav').Accordion(); * @before
* @desc Creates an Accordion from the given definition list * * @example jQuery('#nav').Accordion({ * header: '.title' * }); * @before * @desc Creates an Accordion from the given div structure * * @example jQuery('#nav').Accordion({ * header: '.head', * navigation: true * }); * @before * @after * @desc Creates an Accordion from the given navigation list, activating those accordion parts * that match the current location.href. Assuming the user clicked on "Fantasy" in the "Movies" section, * the accordion displayed after loading the page with the "Movies" section open and the "Fantasy" link highlighted * with a class "current". * * @example jQuery('#accordion').Accordion().change(function(event, newHeader, oldHeader, newContent, oldContent) { * jQuery('#status').html(newHeader.text()); * }); * @desc Updates the element with id status with the text of the selected header every time the accordion changes * * @param Map options key/value pairs of optional settings. * @option String|Element|jQuery|Boolean|Number active Selector for the active element. Set to false to display none at start. Default: first child * @option String|Element|jQuery header Selector for the header element, eg. 'div.title', 'a.head'. Default: first child's tagname * @option String|Number speed * @option String selectedClass Class for active header elements. Default: 'selected' * @option Boolean alwaysOpen Whether there must be one content element open. Default: true * @option Boolean|String animated Choose your favorite animation, or disable them (set to false). In addition to the default, "bounceslide" and "easeslide" are supported (both require the easing plugin). Default: 'slide' * @option String event The event on which to trigger the accordion, eg. "mouseover". Default: "click" * @option Boolean navigation If set, looks for the anchor that matches location.href and activates it. Great for href-based pseudo-state-saving. Default: false * @option Boolean autoheight If set, the highest content part is used as height reference for all other parts. Provides more consistent animations. Default: false * * @type jQuery * @see activate(Number) * @name Accordion * @cat Plugins/Accordion */ /** * Activate a content part of the Accordion programmatically. * * The index can be a zero-indexed number to match the position of the header to close * or a string expression matching an element. Pass -1 to close all (only possible with alwaysOpen:false). * * @example jQuery('#accordion').activate(1); * @desc Activate the second content of the Accordion contained in