mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-28 20:52:21 +01:00
Fix hidden.bs.tooltip and shown.bs.tooltip events firing too early in tooltip.js
* events fire only after the CSS animation is completed * this fixes also events in popover.js (as it inherits from tooltip.js)
This commit is contained in:
parent
8f83a6010a
commit
0adb4e35f0
@ -139,6 +139,7 @@
|
|||||||
this.$element.trigger(e)
|
this.$element.trigger(e)
|
||||||
|
|
||||||
if (e.isDefaultPrevented()) return
|
if (e.isDefaultPrevented()) return
|
||||||
|
var that = this;
|
||||||
|
|
||||||
var $tip = this.tip()
|
var $tip = this.tip()
|
||||||
|
|
||||||
@ -188,7 +189,17 @@
|
|||||||
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
|
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
|
||||||
|
|
||||||
this.applyPlacement(calculatedOffset, placement)
|
this.applyPlacement(calculatedOffset, placement)
|
||||||
this.$element.trigger('shown.bs.' + this.type)
|
|
||||||
|
var complete = function() {
|
||||||
|
that.$element.trigger('shown.bs.' + that.type)
|
||||||
|
}
|
||||||
|
|
||||||
|
$.support.transition && this.$tip.hasClass('fade') ?
|
||||||
|
$tip
|
||||||
|
.one($.support.transition.end, complete)
|
||||||
|
.emulateTransitionEnd(150) :
|
||||||
|
complete()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,6 +273,7 @@
|
|||||||
|
|
||||||
function complete() {
|
function complete() {
|
||||||
if (that.hoverState != 'in') $tip.detach()
|
if (that.hoverState != 'in') $tip.detach()
|
||||||
|
that.$element.trigger('hidden.bs.' + that.type)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$element.trigger(e)
|
this.$element.trigger(e)
|
||||||
@ -276,8 +288,6 @@
|
|||||||
.emulateTransitionEnd(150) :
|
.emulateTransitionEnd(150) :
|
||||||
complete()
|
complete()
|
||||||
|
|
||||||
this.$element.trigger('hidden.bs.' + this.type)
|
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user