Keen - The Ultimate Multi-Demo Bootstrap Admin Theme

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

Keen Toggle

Overview

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

Initialization

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

var asideLeftToggle = new KToggle('k_aside_toggler', options);

Options

var options = {
    target: 'body',
    targetState: 'k-header__topbar--mobile-on',
    togglerState: 'k-header-mobile__toolbar-topbar-toggler--active'
}; 
Field Type Description
target string

The target for the class name changed

Sample
target: 'body'
targetState string

The state class name to be added to the target

Sample
targetState: 'k-header__topbar--mobile-on'
togglerState string

The active state for the toggler

Sample
togglerState: 'k-header-mobile__toolbar-topbar-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

getState()

Get toggler state

toggle()

Toggle the toggler

toggleOn()

Set the toggler on

toggleOff()

Set the toggler off

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