Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit ee68bcb8ae2c42fdb1a9736db63c254eb83066f1 1 parent 14a4219
Aaron Newton authored
Showing with 6 additions and 1 deletion.
  1. +1 −0  Docs/UI/Bootstrap.Tooltip.md
  2. +5 −1 Source/UI/Bootstrap.Tooltip.js
1  Docs/UI/Bootstrap.Tooltip.md
View
@@ -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
6 Source/UI/Bootstrap.Tooltip.js
View
@@ -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,
Please sign in to comment.
Something went wrong with that request. Please try again.