0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Placement auto for tooltips

This commit is contained in:
Johann-S 2017-05-24 13:48:32 +02:00
parent 460ff235fa
commit 2c72af88ee
3 changed files with 18 additions and 0 deletions

View File

@ -51,6 +51,7 @@ const Tooltip = (($) => {
} }
const AttachmentMap = { const AttachmentMap = {
AUTO : 'auto',
TOP : 'top', TOP : 'top',
RIGHT : 'right', RIGHT : 'right',
BOTTOM : 'bottom', BOTTOM : 'bottom',

View File

@ -28,6 +28,9 @@
<hr> <hr>
<p> <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"> <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
Tooltip on top Tooltip on top
</button> </button>

View File

@ -74,6 +74,20 @@
border-left-color: $tooltip-arrow-color; 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 { .arrow::before {
position: absolute; position: absolute;