mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-14 18:42:30 +03:00
Tooltip: merge timeout functionality
This commit is contained in:
+7
-16
@@ -526,16 +526,9 @@ class Tooltip extends BaseComponent {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
clearTimeout(this._timeout)
|
|
||||||
|
|
||||||
this._hoverState = HOVER_STATE_SHOW
|
this._hoverState = HOVER_STATE_SHOW
|
||||||
|
|
||||||
if (!this._config.delay.show) {
|
this._setTimeout(() => {
|
||||||
this.show()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this._timeout = setTimeout(() => {
|
|
||||||
if (this._hoverState === HOVER_STATE_SHOW) {
|
if (this._hoverState === HOVER_STATE_SHOW) {
|
||||||
this.show()
|
this.show()
|
||||||
}
|
}
|
||||||
@@ -547,22 +540,20 @@ class Tooltip extends BaseComponent {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
clearTimeout(this._timeout)
|
|
||||||
|
|
||||||
this._hoverState = HOVER_STATE_OUT
|
this._hoverState = HOVER_STATE_OUT
|
||||||
|
|
||||||
if (!this._config.delay.hide) {
|
this._setTimeout(() => {
|
||||||
this.hide()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this._timeout = setTimeout(() => {
|
|
||||||
if (this._hoverState === HOVER_STATE_OUT) {
|
if (this._hoverState === HOVER_STATE_OUT) {
|
||||||
this.hide()
|
this.hide()
|
||||||
}
|
}
|
||||||
}, this._config.delay.hide)
|
}, this._config.delay.hide)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_setTimeout(handler, timeout) {
|
||||||
|
clearTimeout(this._timeout)
|
||||||
|
this._timeout = setTimeout(handler, timeout)
|
||||||
|
}
|
||||||
|
|
||||||
_isWithActiveTrigger() {
|
_isWithActiveTrigger() {
|
||||||
return Object.values(this._activeTrigger).includes(true)
|
return Object.values(this._activeTrigger).includes(true)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user