Keen - The Ultimate Multi-Demo Bootstrap Admin Theme

The most complete UI/UX template solution for today's web projects of any size

Keen Offcanvas

Overview

KOffcanvas is a Keen's custom plugin defined in [root]/theme/default/src/theme/framework/components/base/offcanvas/offcanvas.js.

Initialization

First parameter is the id, class, or tag of the HTML element. The second parameter is for the options.

var headerMenuOffcanvas = new KOffcanvas(id, options)
var headerMenuOffcanvas = new KOffcanvas('k_header_menu_wrapper', {
    overlay: true,
    baseClass: 'k-header-menu-wrapper',
    closeBy: 'k_header_menu_mobile_close_btn',
    toggleBy: {
        target: 'k_header_mobile_toggler',
        state: 'k-header-mobile__toolbar-toggler--active'
    }
});

Options

var options = {
    overlay: true,
    baseClass: 'k-header-menu-wrapper',
    closeBy: 'k_header_menu_mobile_close_btn',
    toggleBy: {
        target: 'k_header_mobile_toggler',
        state: 'k-header-mobile__toolbar-toggler--active'
    }
}
Field Type Description
overlay boolean

Enable/disable offcanvas overlay

Sample
overlay: true
baseClass string

Set the base class for the offcanvas

Sample
baseClass: 'k-header-menu-wrapper'
closeBy string

Define the element for the off canvas to be closed when this element is clicked

Sample
closeBy: 'k_header_menu_mobile_close_btn'
toggleBy object

Define which element for the toggle and set the active state class name

Sample
toggleBy: {
    target: 'k_header_mobile_toggler',
    state: 'k-header-mobile__toolbar-toggler--active'
}

API Methods

Method Description
setDefaults(options)

Set default options

Input Parameters
Name Type Description
options object

A new options object for the menu

show()

Set show dropdown

hide()

Set hide dropdown

on(name, handler)

Register event

Input Parameters
Name Type Description
name string

Unique event name

handler function

Callback function handler for the event

one(name, handler)

Register event to be run once

Input Parameters
Name Type Description
name string

Unique event name

handler function

Callback function handler for the event