Accordion Class

Make the selected elements Accordion widgets. Semantic requirements: The markup of your accordion container needs pairs of headers and content panels. By default, the header elements are anchors, assuming the following structure: First headerFirst contentSecond headerSecond contentIf you use a different element for the header, specify the header-option with an appropriate selector, eg. header: 'h3'. The content element must be always next to its header. If you have links inside the accordion content and use a-elements as headers, add a class to them and use that as the header, eg. header: 'a.header'. Use activate(Number) to change the active content programmatically. [edit]NOTE: If you want multiple sections open at once, don't use an accordion An accordion doesn't allow more than one content panel to be open at the same time, and it takes a lot of effort to do that. If you are looking for a widget that allows more than one content panel to be open, don't use this. Usually it can be written with a few lines of jQuery instead, something like this: jQuery(document).ready(function(){ $('.accordion .head').click(function() { $(this).next().toggle(); return false; }).next().hide(); });Or animated: jQuery(document).ready(function(){ $('.accordion .head').click(function() { $(this).next().toggle('slow'); return false; }).next().hide(); });

Namespace: SharpKit.jQuery.UI.Controls

Constructors

Name Description
Accordion(JsString, AccordionOptions) Creates a new instance of Accordion
Accordion(JsString) Creates a new instance of Accordion

Properties

Name Description
active Selector for the active element. Set to false to display none at start. Needs collapsible: true. Default: first child Types: Selector, Element, jQuery, Boolean, Number
animated Choose your favorite animation, or disable them (set to false). In addition to the default, 'bounceslide' and all defined easing methods are supported ('bounceslide' requires UI Effects Core). Default: 'slide' Types: Boolean, String
autoHeight If set, the highest content part is used as height reference for all other parts. Provides more consistent animations. Default: true
change This event is triggered every time the accordion changes. If the accordion is animated, the event will be triggered upon completion of the animation; otherwise, it is triggered immediately. $('.ui-accordion').bind('accordionchange', function(event, ui) { ui.newHeader // jQuery object, activated header ui.oldHeader // jQuery object, previous header ui.newContent // jQuery object, activated content ui.oldContent // jQuery object, previous content }); Default: null
changestart This event is triggered every time the accordion starts to change. $('.ui-accordion').bind('accordionchangestart', function(event, ui) { ui.newHeader // jQuery object, activated header ui.oldHeader // jQuery object, previous header ui.newContent // jQuery object, activated content ui.oldContent // jQuery object, previous content }); Default: null
clearStyle If set, clears height and overflow styles after finishing animations. This enables accordions to work with dynamic content. Won't work together with autoHeight. Default: false
collapsible Whether all the sections can be closed at once. Allows collapsing the active section by the triggering event (click is the default). Default: false
event The event on which to trigger the accordion. Default: 'click'
fillSpace If set, the accordion completely fills the height of the parent element. Overrides autoheight. Default: false
header Selector for the header element. Default: '> li > :first-child,> :not(li):even' Types: Selector, jQuery
icons Icons to use for headers. Icons may be specified for 'header' and 'headerSelected', and we recommend using the icons native to the jQuery UI CSS Framework manipulated by jQuery UI ThemeRoller Default: { 'header': 'ui-icon-triangle-1-e', 'headerSelected': 'ui-icon-triangle-1-s' }
navigation If set, looks for the anchor that matches location.href and activates it. Great for href-based state-saving. Use navigationFilter to implement your own matcher. Default: false
navigationFilter Overwrite the default location.href-matching with your own matcher. Default:
© Copyright 2005-2011 SharpKit. All rights reserved.