1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-16 10:34:07 +02:00
This commit is contained in:
fat
2013-05-27 12:48:16 -07:00
parent 9257bdc097
commit a7a87c8e8c
2 changed files with 12 additions and 9 deletions

View File

@@ -1100,7 +1100,7 @@
return options return options
} }
Tooltip.prototype.enter = function (e) { Tooltip.prototype.enter = function (obj) {
var defaults = this.getDefaults() var defaults = this.getDefaults()
var options = {} var options = {}
@@ -1108,26 +1108,29 @@
if (defaults[key] != value) options[key] = value if (defaults[key] != value) options[key] = value
}) })
var self = $(e.currentTarget)[this.type](options).data('bs.' + this.type) var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
if (!self.options.delay || !self.options.delay.show) return self.show() if (!self.options.delay || !self.options.delay.show) return self.show()
clearTimeout(this.timeout) clearTimeout(this.timeout)
self.hoverState = 'in' self.hoverState = 'in'
this.timeout = setTimeout(function() { this.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show() if (self.hoverState == 'in') self.show()
}, self.options.delay.show) }, self.options.delay.show)
} }
Tooltip.prototype.leave = function (e) { Tooltip.prototype.leave = function (obj) {
var self = $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this._options).data('bs.' + this.type)
clearTimeout(this.timeout)
if (this.timeout) clearTimeout(this.timeout)
if (!self.options.delay || !self.options.delay.hide) return self.hide() if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.hoverState = 'out' self.hoverState = 'out'
this.timeout = setTimeout(function() { this.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide() if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide) }, self.options.delay.hide)
} }
@@ -1324,7 +1327,7 @@
Tooltip.prototype.toggle = function (e) { Tooltip.prototype.toggle = function (e) {
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
self.tip().hasClass('in') ? self.leave(e) : self.enter(e) self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
} }
Tooltip.prototype.destroy = function () { Tooltip.prototype.destroy = function () {

File diff suppressed because one or more lines are too long