/* * Accordion 1.3 - jQuery menu widget * * Copyright (c) 2006 Jörn Zaefferer, Frank Marcia * * 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 1524 2007-03-13 20:09:19Z joern $ * */ /** * 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: 'div.title' * }); * @before * @desc Creates an Accordion from the given div structure * * @example jQuery('#nav').Accordion({ * header: 'a.head' * }); * @before * @desc Creates an Accordion from the given navigation list * * @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 active Selector for the active element, default is the first child, set to false to display none at start * @option String|Element|jQuery header Selector for the header element, eg. div.title, a.head, default is the first child's tagname * @option String|Number showSpeed Speed for the slideIn, default is 'slow' (for numbers: smaller = faster) * @option String|Number hideSpeed Speed for the slideOut, default is 'fast' (for numbers: smaller = faster) * @option String selectedClass Class for active header elements, default is 'selected' * @option Boolean alwaysOpen Whether there must be one content element open, default is true. * @option Boolean animated Set to false to disable animations. Default: true * @option String event The event on which to trigger the accordion, eg. "mouseover". Default: "click" * * @type jQuery * @see activate(Number) * @name Accordion * @cat Plugins/Accordion */ /** * Activate a content part of the Accordion programmatically at the given zero-based index. * * If the index is not specified, it defaults to zero, if it is an invalid index, eg. a string, * nothing happens. * * @example jQuery('#accordion').activate(1); * @desc Activate the second content of the Accordion contained in