aboutsummaryrefslogtreecommitdiff
path: root/js/tooltip.js
diff options
context:
space:
mode:
authorfat <[email protected]>2013-05-16 17:44:50 -0700
committerfat <[email protected]>2013-05-16 17:44:50 -0700
commita72d0d6e3a5f2691eaa7e036a7b081d021097159 (patch)
treeca0c1037f00dad04ed1d19bcded06762bbfd2cc5 /js/tooltip.js
parent19de2e86035746b4cda13d4e3860bc549b4f4841 (diff)
downloadbootstrap-a72d0d6e3a5f2691eaa7e036a7b081d021097159.tar.xz
bootstrap-a72d0d6e3a5f2691eaa7e036a7b081d021097159.zip
fix tests
Diffstat (limited to 'js/tooltip.js')
-rw-r--r--js/tooltip.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/js/tooltip.js b/js/tooltip.js
index 60cbe1200..a40d242fc 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -48,10 +48,10 @@
}
Tooltip.prototype.init = function (type, element, options) {
- this.type = type
- this.options = this.getOptions(options)
this.enabled = true
+ this.type = type
this.$element = $(element)
+ this.options = this.getOptions(options)
var triggers = this.options.trigger.split(' ')
@@ -99,7 +99,7 @@
if (defaults[key] != value) options[key] = value
}, this)
- var self = $(e.currentTarget)[this.type](options).data(this.type)
+ var self = $(e.currentTarget)[this.type](options).data('bs-' + this.type)
if (!self.options.delay || !self.options.delay.show) return self.show()
@@ -112,7 +112,7 @@
}
Tooltip.prototype.leave = function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
+ var self = $(e.currentTarget)[this.type](this._options).data('bs-' + this.type)
if (this.timeout) clearTimeout(this.timeout)
if (!self.options.delay || !self.options.delay.hide) return self.hide()
@@ -168,10 +168,12 @@
}
this.applyPlacement(tp, placement)
- this.$element.trigger('shown')
+ this.$element.trigger('bs:' + this.type + ':shown')
}
+ }
Tooltip.prototype.applyPlacement = function(offset, placement) {
+ var replace
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
@@ -185,7 +187,7 @@
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
- var replace = true
+ replace = true
offset.top = offset.top + height - actualHeight
}
@@ -210,7 +212,7 @@
if (replace) $tip.offset(offset)
}
- Tooltip.prototype.replaceArrow = function(delta, dimension, position){
+ Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
}
@@ -248,7 +250,7 @@
removeWithAnimation() :
$tip.detach()
- this.$element.trigger('hidden')
+ this.$element.trigger('bs:' + this.type + ':hidden')
return this
}
@@ -312,12 +314,12 @@
}
Tooltip.prototype.toggle = function (e) {
- var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
+ var self = e ? $(e.currentTarget)[this.type](this._options).data('bs-' + this.type) : this
self.tip().hasClass('in') ? self.hide() : self.show()
}
Tooltip.prototype.destroy = function () {
- this.hide().$element.off('.' + this.type).removeData(this.type)
+ this.hide().$element.off('.' + this.type).removeData('bs-' + this.type)
}
@@ -326,7 +328,7 @@
var old = $.fn.tooltip
- $.fn.tooltip = function ( option ) {
+ $.fn.tooltip = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs-tooltip')