Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfat <jacobthornton@gmail.com>2013-02-06 10:29:59 +0400
committerfat <jacobthornton@gmail.com>2013-02-06 10:29:59 +0400
commit481428154084a9fafd31d8654157d6f6f78231d0 (patch)
treebe95c0621248574864f79141c1e6103721c84354 /docs/assets/js/bootstrap.js
parent5e4db94c240c5ac2af18bbf4238358a043ad4037 (diff)
clean up styles
Diffstat (limited to 'docs/assets/js/bootstrap.js')
-rw-r--r--docs/assets/js/bootstrap.js57
1 files changed, 52 insertions, 5 deletions
diff --git a/docs/assets/js/bootstrap.js b/docs/assets/js/bootstrap.js
index 39c705387b..99dbc74885 100644
--- a/docs/assets/js/bootstrap.js
+++ b/docs/assets/js/bootstrap.js
@@ -1194,15 +1194,58 @@
break
}
- $tip
- .offset(tp)
- .addClass(placement)
- .addClass('in')
-
+ this.applyPlacement(tp, placement)
this.$element.trigger('shown')
}
}
+ , applyPlacement: function(offset, placement){
+ var $tip = this.tip()
+ , width = $tip[0].offsetWidth
+ , height = $tip[0].offsetHeight
+ , actualWidth
+ , actualHeight
+ , delta
+ , replace
+
+ $tip
+ .offset(offset)
+ .addClass(placement)
+ .addClass('in')
+
+ actualWidth = $tip[0].offsetWidth
+ actualHeight = $tip[0].offsetHeight
+
+ if (placement == 'top' && actualHeight != height) {
+ offset.top = offset.top + height - actualHeight
+ replace = true
+ }
+
+ if (placement == 'bottom' || placement == 'top') {
+ delta = 0
+
+ if (offset.left < 0){
+ delta = offset.left * -2
+ offset.left = 0
+ $tip.offset(offset)
+ actualWidth = $tip[0].offsetWidth
+ actualHeight = $tip[0].offsetHeight
+ }
+
+ this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
+ } else {
+ this.replaceArrow(actualHeight - height, actualHeight, 'top')
+ }
+
+ if (replace) $tip.offset(offset)
+ }
+
+ , replaceArrow: function(delta, dimension, position){
+ this
+ .arrow()
+ .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
+ }
+
, setContent: function () {
var $tip = this.tip()
, title = this.getTitle()
@@ -1275,6 +1318,10 @@
return this.$tip = this.$tip || $(this.options.template)
}
+ , arrow: function(){
+ return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
+ }
+
, validate: function () {
if (!this.$element[0].parentNode) {
this.hide()