carousel: cache element query
This commit is contained in:
parent
a33d7b2d21
commit
a33f970233
1 changed files with 4 additions and 2 deletions
|
|
@ -253,12 +253,14 @@ class Carousel {
|
|||
}
|
||||
|
||||
_addEventListeners() {
|
||||
const $element = $(this._element)
|
||||
|
||||
if (this._config.keyboard) {
|
||||
$(this._element).on(EVENT_KEYDOWN, event => this._keydown(event))
|
||||
$element.on(EVENT_KEYDOWN, event => this._keydown(event))
|
||||
}
|
||||
|
||||
if (this._config.pause === 'hover') {
|
||||
$(this._element)
|
||||
$element
|
||||
.on(EVENT_MOUSEENTER, event => this.pause(event))
|
||||
.on(EVENT_MOUSELEAVE, event => this.cycle(event))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue