mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-26 05:19:15 +02:00
Tooltips fires show, shown, hide, hidden events
It is re-worked from #3691.
This commit is contained in:
11
js/bootstrap-tooltip.js
vendored
11
js/bootstrap-tooltip.js
vendored
@@ -110,8 +110,11 @@
|
||||
, actualHeight
|
||||
, placement
|
||||
, tp
|
||||
, e
|
||||
|
||||
if (this.hasContent() && this.enabled) {
|
||||
this.$element.trigger(e = $.Event('show'))
|
||||
if (e.isDefaultPrevented()) return
|
||||
$tip = this.tip()
|
||||
this.setContent()
|
||||
|
||||
@@ -152,6 +155,8 @@
|
||||
.offset(tp)
|
||||
.addClass(placement)
|
||||
.addClass('in')
|
||||
|
||||
this.$element.trigger('shown')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +171,10 @@
|
||||
, hide: function () {
|
||||
var that = this
|
||||
, $tip = this.tip()
|
||||
, e
|
||||
|
||||
this.$element.trigger(e = $.Event('hide'))
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
$tip.removeClass('in')
|
||||
|
||||
@@ -184,6 +193,8 @@
|
||||
removeWithAnimation() :
|
||||
$tip.detach()
|
||||
|
||||
this.$element.trigger('hidden')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user