-
Notifications
You must be signed in to change notification settings - Fork 17
Callbacks
Dane Williams edited this page Dec 29, 2016
·
4 revisions
Almost every action performed by the dropdown is preceded and followed by a callback event, allowing for modifications to the dropdown behaviour and integration with other scripts.
Each event has a corresponding :before event which occurs before the event takes place, for example, dropdown.open:before.
- Triggered when the dropdown is opened
$(element).on( 'dropdown.open', function( e, dropdown ) {
...
});
- Triggered when the dropdown is closed
$(element).on( 'dropdown.close', function( e, dropdown ) {
...
});
- Triggered when the dropdown is resized
- Returns the menu being resized
$(element).on( 'dropdown.resize', function( e, menu, dropdown ) {
...
});
- Triggered when the dropdown is reset
$(element).on( 'dropdown.reset', function( e, dropdown ) {
...
});
- Triggered when a menu is opened
- Returns the target menu and current menu
$(element).on( 'dropdown.menu.open', function( e, menu, cur, dropdown ) {
...
});
- Triggered when a menu is close
- Returns the current menu and target menu
$(element).on( 'dropdown.menu.close', function( e, cur, menu, dropdown ) {
...
});
- Triggered when an item is selected
- Returns the target item and current/previous selected item
$(element).on( 'dropdown.select', function( e, item, prev, dropdown ) {
...
});
- Triggered when an item is deselected
- Returns the item to be deselected
$(element).on( 'dropdown.deselect', function( e, item, dropdown ) {
...
});