From: Troy Morehouse Date: Tue, 12 Dec 2017 09:36:54 +0000 (-0400) Subject: tooltip+popover: add boundary config option (#24979) X-Git-Tag: v4.0.0-beta.3~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f1e746d70649e17956b0db03f5cd127e5012fab;p=thirdparty%2Fbootstrap.git tooltip+popover: add boundary config option (#24979) --- diff --git a/docs/4.0/components/popovers.md b/docs/4.0/components/popovers.md index 9f0472e3e3..f500847089 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 Allow to specify which position Popper will use on fallback. For more information refer to Popper.js's behavior docs + + boundary + string | element + 'scrollParent' + Overflow constraint boundary of the popover. Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's preventOverflow docs. + diff --git a/docs/4.0/components/tooltips.md b/docs/4.0/components/tooltips.md index 766b726ed3..d0ef701835 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 Allow to specify which position Popper will use on fallback. For more information refer to Popper.js's behavior docs + + boundary + string | element + 'scrollParent' + Overflow constraint boundary of the tooltip. Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's preventOverflow docs. + diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 573997e7da..e348fdf208 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) => {