aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTroy Morehouse <[email protected]>2017-12-12 05:36:54 -0400
committerXhmikosR <[email protected]>2017-12-12 11:36:54 +0200
commit6f1e746d70649e17956b0db03f5cd127e5012fab (patch)
tree5fd34d9f143be2e9f153de2665448144f5246ed9
parent8839c03865f02cf9c98443f4e07ac477985151ed (diff)
downloadbootstrap-6f1e746d70649e17956b0db03f5cd127e5012fab.tar.xz
bootstrap-6f1e746d70649e17956b0db03f5cd127e5012fab.zip
tooltip+popover: add boundary config option (#24979)
-rw-r--r--docs/4.0/components/popovers.md6
-rw-r--r--docs/4.0/components/tooltips.md6
-rw-r--r--js/src/tooltip.js9
3 files changed, 19 insertions, 2 deletions
diff --git a/docs/4.0/components/popovers.md b/docs/4.0/components/popovers.md
index 9f0472e3e..f50084708 100644
--- a/docs/4.0/components/popovers.md
+++ b/docs/4.0/components/popovers.md
@@ -264,6 +264,12 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
<td>Allow to specify which position Popper will use on fallback. For more information refer to
Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..flip.behavior">behavior docs</a></td>
</tr>
+ <tr>
+ <td>boundary</td>
+ <td>string | element</td>
+ <td>'scrollParent'</td>
+ <td>Overflow constraint boundary of the popover. Accepts the values of <code>'viewport'</code>, <code>'window'</code>, <code>'scrollParent'</code>, or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..preventOverflow.boundariesElement">preventOverflow docs</a>.</td>
+ </tr>
</tbody>
</table>
diff --git a/docs/4.0/components/tooltips.md b/docs/4.0/components/tooltips.md
index 766b726ed..d0ef70183 100644
--- a/docs/4.0/components/tooltips.md
+++ b/docs/4.0/components/tooltips.md
@@ -244,6 +244,12 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
<td>Allow to specify which position Popper will use on fallback. For more information refer to
Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..flip.behavior">behavior docs</a></td>
</tr>
+ <tr>
+ <td>boundary</td>
+ <td>string | element</td>
+ <td>'scrollParent'</td>
+ <td>Overflow constraint boundary of the tooltip. Accepts the values of <code>'viewport'</code>, <code>'window'</code>, <code>'scrollParent'</code>, or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..preventOverflow.boundariesElement">preventOverflow docs</a>.</td>
+ </tr>
</tbody>
</table>
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 573997e7d..e348fdf20 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -38,7 +38,8 @@ const Tooltip = (($) => {
placement : '(string|function)',
offset : '(number|string)',
container : '(string|element|boolean)',
- fallbackPlacement : '(string|array)'
+ fallbackPlacement : '(string|array)',
+ boundary : '(string|element)'
}
const AttachmentMap = {
@@ -62,7 +63,8 @@ const Tooltip = (($) => {
placement : 'top',
offset : 0,
container : false,
- fallbackPlacement : 'flip'
+ fallbackPlacement : 'flip',
+ boundary : 'scrollParent'
}
const HoverState = {
@@ -301,6 +303,9 @@ const Tooltip = (($) => {
},
arrow: {
element: Selector.ARROW
+ },
+ preventOverflow: {
+ boundariesElement: this.config.boundary
}
},
onCreate: (data) => {