aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorandyexeter <[email protected]>2016-09-15 10:33:11 +0100
committerBardi Harborow <[email protected]>2016-11-26 19:13:15 +1100
commit0ded703f6bb7b0c60b1ec8e90592c845ca07d46e (patch)
tree56082cb8992db4a4c6a009e3526eaa41da3521db /js
parent308bc77dbb412e4df1194459a9b34ad72da02ca6 (diff)
downloadbootstrap-0ded703f6bb7b0c60b1ec8e90592c845ca07d46e.tar.xz
bootstrap-0ded703f6bb7b0c60b1ec8e90592c845ca07d46e.zip
Implement container option for tooltips and popovers.
Diffstat (limited to 'js')
-rw-r--r--js/src/tooltip.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 822ae3652..94f77a2a4 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -46,7 +46,8 @@ const Tooltip = (($) => {
selector : false,
placement : 'top',
offset : '0 0',
- constraints : []
+ constraints : [],
+ container : false
}
const DefaultType = {
@@ -59,7 +60,8 @@ const Tooltip = (($) => {
selector : '(string|boolean)',
placement : '(string|function)',
offset : 'string',
- constraints : 'array'
+ constraints : 'array',
+ container : '(string|element|boolean)'
}
const AttachmentMap = {
@@ -274,9 +276,11 @@ const Tooltip = (($) => {
const attachment = this._getAttachment(placement)
+ const container = this.config.container === false ? document.body : $(this.config.container)
+
$(tip)
.data(this.constructor.DATA_KEY, this)
- .appendTo(document.body)
+ .appendTo(container)
$(this.element).trigger(this.constructor.Event.INSERTED)