aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-tooltip.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2012-12-19 23:39:40 -0800
committerMark Otto <[email protected]>2012-12-19 23:39:40 -0800
commit5d776bcfd2e7da0bcce37252dc983149d8b2d377 (patch)
tree0b46eb3b33008f4d4b4ea3bd73ce82ed77218d7d /js/bootstrap-tooltip.js
parentdc6142751feced6761f67503323c0c6e62844d4e (diff)
parentbbe4625672c5122bb2b06c495f9ea41752c10467 (diff)
downloadbootstrap-5d776bcfd2e7da0bcce37252dc983149d8b2d377.tar.xz
bootstrap-5d776bcfd2e7da0bcce37252dc983149d8b2d377.zip
Merge branch '2.2.3' of github.com:twitter/bootstrap into 2.2.3
Diffstat (limited to 'js/bootstrap-tooltip.js')
-rw-r--r--js/bootstrap-tooltip.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js
index e7e2d6b3c..25bba1589 100644
--- a/js/bootstrap-tooltip.js
+++ b/js/bootstrap-tooltip.js
@@ -97,7 +97,6 @@
, show: function () {
var $tip
- , inside
, pos
, actualWidth
, actualHeight
@@ -116,19 +115,17 @@
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
- inside = /in/.test(placement)
-
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.insertAfter(this.$element)
- pos = this.getPosition(inside)
+ pos = this.getPosition()
actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight
- switch (inside ? placement.split(' ')[1] : placement) {
+ switch (placement) {
case 'bottom':
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
break
@@ -193,11 +190,12 @@
return this.getTitle()
}
- , getPosition: function (inside) {
- return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
- width: this.$element[0].offsetWidth
- , height: this.$element[0].offsetHeight
- })
+ , getPosition: function () {
+ var el = this.$element[0]
+ return $.extend({}, el.getBoundingClientRect ? el.getBoundingClientRect() : {
+ width: el.offsetWidth
+ , height: el.offsetHeight
+ }, this.$element.offset())
}
, getTitle: function () {