diff options
| author | Johann-S <[email protected]> | 2017-05-24 13:48:32 +0200 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2017-05-24 14:57:40 +0200 |
| commit | 2c72af88ee177758f67bc7797b95f7dfc95f701b (patch) | |
| tree | 858f16deafe3c1358e48a92ac12f03c9d943aa4a | |
| parent | 460ff235fa26834b35a99c1b71dd67cd6835e88a (diff) | |
| download | bootstrap-2c72af88ee177758f67bc7797b95f7dfc95f701b.tar.xz bootstrap-2c72af88ee177758f67bc7797b95f7dfc95f701b.zip | |
Placement auto for tooltips
| -rw-r--r-- | js/src/tooltip.js | 1 | ||||
| -rw-r--r-- | js/tests/visual/tooltip.html | 3 | ||||
| -rw-r--r-- | scss/_tooltip.scss | 14 |
3 files changed, 18 insertions, 0 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js index ceb9bc04c..1d53b0470 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -51,6 +51,7 @@ const Tooltip = (($) => { } const AttachmentMap = { + AUTO : 'auto', TOP : 'top', RIGHT : 'right', BOTTOM : 'bottom', diff --git a/js/tests/visual/tooltip.html b/js/tests/visual/tooltip.html index c45926eba..172cb29ad 100644 --- a/js/tests/visual/tooltip.html +++ b/js/tests/visual/tooltip.html @@ -28,6 +28,9 @@ <hr> <p> + <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="auto" title="Tooltip on auto"> + Tooltip on auto + </button> <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top"> Tooltip on top </button> diff --git a/scss/_tooltip.scss b/scss/_tooltip.scss index c62ce9779..fe97fbbbd 100644 --- a/scss/_tooltip.scss +++ b/scss/_tooltip.scss @@ -74,6 +74,20 @@ border-left-color: $tooltip-arrow-color; } } + &.bs-tooltip-auto { + &[x-placement^="top"] { + @extend .bs-tooltip-top; + } + &[x-placement^="right"] { + @extend .bs-tooltip-right; + } + &[x-placement^="bottom"] { + @extend .bs-tooltip-bottom; + } + &[x-placement^="left"] { + @extend .bs-tooltip-left; + } + } .arrow::before { position: absolute; |
