aboutsummaryrefslogtreecommitdiff
path: root/js/tooltip.js
diff options
context:
space:
mode:
authorIvan Khalopik <[email protected]>2013-06-10 10:31:51 +0300
committerIvan Khalopik <[email protected]>2013-06-10 10:31:51 +0300
commite138b0df3a1bcd536cc312d7c4714ff5bc9acd2b (patch)
tree2d6f41184d19466d6f9fa016ba521260413435cb /js/tooltip.js
parent3285f4c3062f4a56eaed2461a3128a2e6a3ba9cc (diff)
parentd74a9634b0cb21a712f5e805c7a21132dc9bee5e (diff)
downloadbootstrap-e138b0df3a1bcd536cc312d7c4714ff5bc9acd2b.tar.xz
bootstrap-e138b0df3a1bcd536cc312d7c4714ff5bc9acd2b.zip
Merge remote-tracking branch 'bootstrap/3.0.0-wip' into 3.0.0-wip
Diffstat (limited to 'js/tooltip.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 () {