mirror of
https://github.com/Hopiu/bootstrap.git
synced 2026-03-25 08:50:22 +00:00
Tooltip: merge timeout functionality
This commit is contained in:
parent
c69ccba08c
commit
8eacbaa08b
1 changed files with 7 additions and 16 deletions
|
|
@ -526,16 +526,9 @@ class Tooltip extends BaseComponent {
|
|||
return
|
||||
}
|
||||
|
||||
clearTimeout(this._timeout)
|
||||
|
||||
this._hoverState = HOVER_STATE_SHOW
|
||||
|
||||
if (!this._config.delay.show) {
|
||||
this.show()
|
||||
return
|
||||
}
|
||||
|
||||
this._timeout = setTimeout(() => {
|
||||
this._setTimeout(() => {
|
||||
if (this._hoverState === HOVER_STATE_SHOW) {
|
||||
this.show()
|
||||
}
|
||||
|
|
@ -547,22 +540,20 @@ class Tooltip extends BaseComponent {
|
|||
return
|
||||
}
|
||||
|
||||
clearTimeout(this._timeout)
|
||||
|
||||
this._hoverState = HOVER_STATE_OUT
|
||||
|
||||
if (!this._config.delay.hide) {
|
||||
this.hide()
|
||||
return
|
||||
}
|
||||
|
||||
this._timeout = setTimeout(() => {
|
||||
this._setTimeout(() => {
|
||||
if (this._hoverState === HOVER_STATE_OUT) {
|
||||
this.hide()
|
||||
}
|
||||
}, this._config.delay.hide)
|
||||
}
|
||||
|
||||
_setTimeout(handler, timeout) {
|
||||
clearTimeout(this._timeout)
|
||||
this._timeout = setTimeout(handler, timeout)
|
||||
}
|
||||
|
||||
_isWithActiveTrigger() {
|
||||
return Object.values(this._activeTrigger).includes(true)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue