added missing expanded/collapsed event in ControlSidebar.js

pull/2197/head
REJack 2019-08-13 13:09:07 +02:00
parent fd8183c965
commit 0876d0ab70
No known key found for this signature in database
GPG Key ID: 9F3976CC630CC888
2 changed files with 11 additions and 3 deletions

View File

@ -18,7 +18,8 @@ const ControlSidebar = (($) => {
const DATA_API_KEY = '.data-api'
const Event = {
CLICK_DATA_API: `click${EVENT_KEY}${DATA_API_KEY}`
COLLAPSED: `collapsed${EVENT_KEY}`,
EXPANDED: `expanded${EVENT_KEY}`
}
const Selector = {
@ -62,6 +63,9 @@ const ControlSidebar = (($) => {
} else {
$('body').removeClass(ClassName.CONTROL_SIDEBAR_OPEN)
}
const expandedEvent = $.Event(Event.EXPANDED)
$(this._element).trigger(expandedEvent)
}
collapse() {
@ -78,6 +82,9 @@ const ControlSidebar = (($) => {
} else {
$('body').addClass(ClassName.CONTROL_SIDEBAR_OPEN)
}
const collapsedEvent = $.Event(Event.COLLAPSED)
$(this._element).trigger(collapsedEvent)
}
toggle() {

View File

@ -54,7 +54,8 @@ $("#my-toggle-button").ControlSidebar('toggle');
|---
| Event Type | Description
|-|-
| | 
|expanded.lte.control.sidebar | Triggered after a control sidebar expands.
|collapsed.lte.control.sidebar | Triggered after a control sidebar collapses.
{: .table .table-bordered .bg-light}
Example: `$('#toggle-button').on('shown.lte.control.sidebar', handleExpandedEvent)`
Example: `$('#toggle-button').on('expanded.lte.control.sidebar', handleExpandedEvent)`