dist/toolkit.js
function(element, options) {
        var self = this;

        element = this.setElement(element).attr('role', 'tablist');
        options = this.setOptions(options, element);

        // Find headers and cache the index of each header and set ARIA attributes
        this.headers = element.find(this.ns('header')).each(function(index) {
            $(this)
                .data('accordion-index', index)
                .attr({
                    role: 'tab',
                    id: self.id('header', index)
                })
                .aria({
                    controls: self.id('section', index),
                    selected: false,
                    expanded: false
                });
        });

        // Find sections and cache the height so we can use for sliding and set ARIA attributes
        this.sections = element.find(this.ns('section')).each(function(index) {
            $(this)
                .attr({
                    role: 'tabpanel',
                    id: self.id('section', index)
                })
                .aria('labelledby', self.id('header', index))
                .conceal();
        });

        // Set events
        this.addEvents([
            ['horizontalresize', 'window', $.debounce(this.calculate.bind(this))],
            ['{mode}', 'element', 'onShow', this.ns('header')]
        ]);

        // Initialize
        this.initialize();

        // Jump to the index on page load
        this.calculate();
        this.jump(options.defaultIndex);
    }
function(element, options) {
        var self = this;

        element = this.setElement(element).attr('role', 'tablist');
        options = this.setOptions(options, element);

        // Find headers and cache the index of each header and set ARIA attributes
        this.headers = element.find(this.ns('header')).each(function(index) {
            $(this)
                .data('accordion-index', index)
                .attr({
                    role: 'tab',
                    id: self.id('header', index)
                })
                .aria({
                    controls: self.id('section', index),
                    selected: false,
                    expanded: false
                });
        });

        // Find sections and cache the height so we can use for sliding and set ARIA attributes
        this.sections = element.find(this.ns('section')).each(function(index) {
            $(this)
                .attr({
                    role: 'tabpanel',
                    id: self.id('section', index)
                })
                .aria('labelledby', self.id('header', index))
                .conceal();
        });

        // Set events
        this.addEvents([
            ['horizontalresize', 'window', $.debounce(this.calculate.bind(this))],
            ['{mode}', 'element', 'onShow', this.ns('header')]
        ]);

        // Initialize
        this.initialize();

        // Jump to the index on page load
        this.calculate();
        this.jump(options.defaultIndex);
    }
function ( element , options ) { var self = this ; element = this . setElement ( element ) . attr ( 'role' , 'tablist' ) ; options = this . setOptions ( options , element ) ; // Find headers and cache the index of each header and set ARIA attributes this . headers = element . find ( this . ns ( 'header' ) ) . each ( function ( index ) { $ ( this ) . data ( 'accordion-index' , index ) . attr ( { role : 'tab' , id : self . id ( 'header' , index ) } ) . aria ( { controls : self . id ( 'section' , index ) , selected : false , expanded : false } ) ; } ) ; // Find sections and cache the height so we can use for sliding and set ARIA attributes this . sections = element . find ( this . ns ( 'section' ) ) . each ( function ( index ) { $ ( this ) . attr ( { role : 'tabpanel' , id : self . id ( 'section' , index ) } ) . aria ( 'labelledby' , self . id ( 'header' , index ) ) . conceal ( ) ; } ) ; // Set events this . addEvents ( [ [ 'horizontalresize' , 'window' , $ . debounce ( this . calculate . bind ( this ) ) ] , [ '{mode}' , 'element' , 'onShow' , this . ns ( 'header' ) ] ] ) ; // Initialize this . initialize ( ) ; // Jump to the index on page load this . calculate ( ) ; this . jump ( options . defaultIndex ) ; }
Initialize the accordion.

@param {jQuery} element
@param {Object} [options]
Initialize the accordion .