aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorfat <[email protected]>2013-05-27 12:45:13 -0700
committerfat <[email protected]>2013-05-27 12:45:13 -0700
commit9257bdc0974beef0a2218c76851dc37f3cf9313a (patch)
tree945f2f323e9891fa0228e7fd172e9f6d3977a46e /js
parent7cbb1c0452a1d9904f7655aea78644def85b7f2e (diff)
downloadbootstrap-9257bdc0974beef0a2218c76851dc37f3cf9313a.tar.xz
bootstrap-9257bdc0974beef0a2218c76851dc37f3cf9313a.zip
fixes #7163
Diffstat (limited to 'js')
-rw-r--r--js/tooltip.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/js/tooltip.js b/js/tooltip.js
index 80bdf7266..d95624bdc 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -91,7 +91,7 @@
return options
}
- Tooltip.prototype.enter = function (e) {
+ Tooltip.prototype.enter = function (obj) {
var defaults = this.getDefaults()
var options = {}
@@ -99,26 +99,29 @@
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()
clearTimeout(this.timeout)
self.hoverState = 'in'
- this.timeout = setTimeout(function() {
+ this.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
- Tooltip.prototype.leave = function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data('bs.' + this.type)
+ Tooltip.prototype.leave = function (obj) {
+ 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()
self.hoverState = 'out'
- this.timeout = setTimeout(function() {
+ this.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
@@ -315,7 +318,7 @@
Tooltip.prototype.toggle = function (e) {
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
- self.tip().hasClass('in') ? self.hide() : self.show()
+ self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
Tooltip.prototype.destroy = function () {