diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index b476f1c4e6dc90f42745881e8929415faf420ad0..1e40a12154c230046df232ca4a1d4706cd48483b 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -141,6 +141,10 @@ break } + if(this.options.position == 'fixed') { + tp.position = 'fixed' + } + $tip .css(tp) .addClass(placement) @@ -199,10 +203,17 @@ } , getPosition: function (inside) { - return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { + var pos = $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { width: this.$element[0].offsetWidth , height: this.$element[0].offsetHeight }) + + if(this.options.position == 'fixed') { + pos.top -= $(document).scrollTop(); + pos.left -= $(document).scrollLeft(); + } + + return pos } , getTitle: function () { @@ -265,6 +276,7 @@ $.fn.tooltip.defaults = { animation: true , placement: 'top' + , position: 'absolute' , selector: false , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' , trigger: 'hover'