From 2c72af88ee177758f67bc7797b95f7dfc95f701b Mon Sep 17 00:00:00 2001 From: Johann-S Date: Wed, 24 May 2017 13:48:32 +0200 Subject: [PATCH] Placement auto for tooltips --- js/src/tooltip.js | 1 + js/tests/visual/tooltip.html | 3 +++ scss/_tooltip.scss | 14 ++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/js/src/tooltip.js b/js/src/tooltip.js index ceb9bc04cc..1d53b0470d 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 c45926eba9..172cb29ad3 100644 --- a/js/tests/visual/tooltip.html +++ b/js/tests/visual/tooltip.html @@ -28,6 +28,9 @@

+ diff --git a/scss/_tooltip.scss b/scss/_tooltip.scss index c62ce9779f..fe97fbbbd0 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;