app/assets/javascripts/twitter/bootstrap/tooltip.js in bootstrap-sass-rails-3.0.0.0.rc2 vs app/assets/javascripts/twitter/bootstrap/tooltip.js in bootstrap-sass-rails-3.0.0.0
- old
+ new
@@ -106,28 +106,30 @@
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
clearTimeout(self.timeout)
+ self.hoverState = 'in'
+
if (!self.options.delay || !self.options.delay.show) return self.show()
- self.hoverState = 'in'
- self.timeout = setTimeout(function () {
+ self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
clearTimeout(self.timeout)
+ self.hoverState = 'out'
+
if (!self.options.delay || !self.options.delay.hide) return self.hide()
- self.hoverState = 'out'
- self.timeout = setTimeout(function () {
+ self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
@@ -256,10 +258,12 @@
Tooltip.prototype.hide = function () {
var that = this
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
- function complete() { $tip.detach() }
+ function complete() {
+ if (that.hoverState != 'in') $tip.detach()
+ }
this.$element.trigger(e)
if (e.isDefaultPrevented()) return