Permalink
Browse files

Making it an option to specify where bootstrap tooltips get injected.

  • Loading branch information...
1 parent 14a4219 commit ee68bcb8ae2c42fdb1a9736db63c254eb83066f1 @anutron committed Oct 20, 2013
Showing with 6 additions and 1 deletion.
  1. +1 −0 Docs/UI/Bootstrap.Tooltip.md
  2. +5 −1 Source/UI/Bootstrap.Tooltip.js
@@ -37,6 +37,7 @@ Bootstrap.Tooltip Method: constructor
* trigger - (*string*) The event type to attach to the target element to show the tip. Choose from `hover`, `focus`, `click`, or 'manual'.
* onOverflow - (*boolean*) Only show the tip if the element's content is overflown (i.e. it's scroll-height or scroll-width is greater than the height or width of the element). Defaults to `false`.
* getContent - (*function*) A function that returns the tip value. By default, it retrieves the value of the `title` option from the target element.
+* inject - (*object*) Where to inject the tip. Defaults to `{target: document.body, where: 'bottom'}`.
### Events
@@ -38,6 +38,10 @@ Bootstrap.Tooltip = Bootstrap.Twipsy = new Class({
trigger: 'hover', //focus, manual
getContent: function(el){
return el.get(this.options.title);
+ },
+ inject: {
+ target: null, //defaults to document.body,
+ where: 'bottom'
}
},
@@ -77,7 +81,7 @@ Bootstrap.Tooltip = Bootstrap.Twipsy = new Class({
}
if (typeOf(this.options.offset) == "object") offset = this.options.offset;
if (this.element.getParent('.modal')) this.tip.inject(this.element, 'after');
- else this.tip.inject(document.body);
+ else this.tip.inject(this.options.inject.target || document.body, this.options.inject.where);
this.tip.show().position({
relativeTo: this.element,
position: pos,

0 comments on commit ee68bcb

Please sign in to comment.