dist/toolkit.js
function(element, options) {
        element = this.setElement(element).attr('role', 'complementary').conceal();
        options = this.setOptions(options, element);

        var animation = options.animation;

        // Touch devices cannot use squish
        if (Toolkit.isTouch && animation === 'squish') {
            options.animation = animation = 'push';
        }

        // Cannot have multiple non-overlayed or non-squished sidebars open
        if (animation !== 'on-top' && animation !== 'squish') {
            options.hideOthers = true;
        }

        // Setup container
        this.container = element.parent().addClass(animation);
        this.primary = element.siblings('[data-offcanvas-content]').attr('role', 'main');
        this.secondary = element.siblings('[data-offcanvas-sidebar]');

        // Determine the side
        this.side = element.data('offcanvas-sidebar') || 'left';
        this.opposite = (this.side === 'left') ? 'right' : 'left';

        // Initialize events
        this.addEvents([
            ['ready', 'document', 'onReady'],
            ['resize', 'window', 'onResize']
        ]);

        if (options.swipe) {
            if (this.side === 'left') {
                this.addEvents([
                    ['swipeleft', 'element', 'hide'],
                    ['swiperight', 'container', 'onSwipe']
                ]);
            } else {
                this.addEvents([
                    ['swipeleft', 'container', 'onSwipe'],
                    ['swiperight', 'element', 'hide']
                ]);
            }
        }

        if (options.selector) {
            this.addEvent('click', 'document', 'toggle', options.selector);
        }

        this.initialize();
    }
function(element, options) {
        element = this.setElement(element).attr('role', 'complementary').conceal();
        options = this.setOptions(options, element);

        var animation = options.animation;

        // Touch devices cannot use squish
        if (Toolkit.isTouch && animation === 'squish') {
            options.animation = animation = 'push';
        }

        // Cannot have multiple non-overlayed or non-squished sidebars open
        if (animation !== 'on-top' && animation !== 'squish') {
            options.hideOthers = true;
        }

        // Setup container
        this.container = element.parent().addClass(animation);
        this.primary = element.siblings('[data-offcanvas-content]').attr('role', 'main');
        this.secondary = element.siblings('[data-offcanvas-sidebar]');

        // Determine the side
        this.side = element.data('offcanvas-sidebar') || 'left';
        this.opposite = (this.side === 'left') ? 'right' : 'left';

        // Initialize events
        this.addEvents([
            ['ready', 'document', 'onReady'],
            ['resize', 'window', 'onResize']
        ]);

        if (options.swipe) {
            if (this.side === 'left') {
                this.addEvents([
                    ['swipeleft', 'element', 'hide'],
                    ['swiperight', 'container', 'onSwipe']
                ]);
            } else {
                this.addEvents([
                    ['swipeleft', 'container', 'onSwipe'],
                    ['swiperight', 'element', 'hide']
                ]);
            }
        }

        if (options.selector) {
            this.addEvent('click', 'document', 'toggle', options.selector);
        }

        this.initialize();
    }
function ( element , options ) { element = this . setElement ( element ) . attr ( 'role' , 'complementary' ) . conceal ( ) ; options = this . setOptions ( options , element ) ; var animation = options . animation ; // Touch devices cannot use squish if ( Toolkit . isTouch && animation === 'squish' ) { options . animation = animation = 'push' ; } // Cannot have multiple non-overlayed or non-squished sidebars open if ( animation !== 'on-top' && animation !== 'squish' ) { options . hideOthers = true ; } // Setup container this . container = element . parent ( ) . addClass ( animation ) ; this . primary = element . siblings ( '[data-offcanvas-content]' ) . attr ( 'role' , 'main' ) ; this . secondary = element . siblings ( '[data-offcanvas-sidebar]' ) ; // Determine the side this . side = element . data ( 'offcanvas-sidebar' ) || 'left' ; this . opposite = ( this . side === 'left' ) ? 'right' : 'left' ; // Initialize events this . addEvents ( [ [ 'ready' , 'document' , 'onReady' ] , [ 'resize' , 'window' , 'onResize' ] ] ) ; if ( options . swipe ) { if ( this . side === 'left' ) { this . addEvents ( [ [ 'swipeleft' , 'element' , 'hide' ] , [ 'swiperight' , 'container' , 'onSwipe' ] ] ) ; } else { this . addEvents ( [ [ 'swipeleft' , 'container' , 'onSwipe' ] , [ 'swiperight' , 'element' , 'hide' ] ] ) ; } } if ( options . selector ) { this . addEvent ( 'click' , 'document' , 'toggle' , options . selector ) ; } this . initialize ( ) ; }
Initialize off canvas.

@param {jQuery} element
@param {Object} [options]
Initialize off canvas .