diff options
| author | Mark Otto <[email protected]> | 2016-10-09 19:56:30 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2016-10-09 19:56:30 -0700 |
| commit | e7f79b32f22d7f39138a7003272b54ceb3b12426 (patch) | |
| tree | 71ff35b97bfa0231729fe1a963e83b60b8c5d972 | |
| parent | ef5bbffd558c63a49c3d64a471138b0e4f5bb660 (diff) | |
| parent | 8ef66df6d793afbda487c1a4505d0a6576252ec4 (diff) | |
| download | bootstrap-e7f79b32f22d7f39138a7003272b54ceb3b12426.tar.xz bootstrap-e7f79b32f22d7f39138a7003272b54ceb3b12426.zip | |
Merge branch 'tooltip-arrow' of https://github.com/brnrdog/bootstrap into brnrdog-tooltip-arrow
| -rw-r--r-- | js/src/popover.js | 4 | ||||
| -rw-r--r-- | js/src/tooltip.js | 1 | ||||
| -rw-r--r-- | scss/_popover.scss | 124 | ||||
| -rw-r--r-- | scss/_tooltip.scss | 27 |
4 files changed, 90 insertions, 66 deletions
diff --git a/js/src/popover.js b/js/src/popover.js index 7ea560812..26ad988d4 100644 --- a/js/src/popover.js +++ b/js/src/popover.js @@ -28,7 +28,6 @@ const Popover = (($) => { trigger : 'click', content : '', template : '<div class="popover" role="tooltip">' - + '<div class="popover-arrow"></div>' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>' }) @@ -44,8 +43,7 @@ const Popover = (($) => { const Selector = { TITLE : '.popover-title', - CONTENT : '.popover-content', - ARROW : '.popover-arrow' + CONTENT : '.popover-content' } const Event = { diff --git a/js/src/tooltip.js b/js/src/tooltip.js index d012b2907..211110882 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -38,7 +38,6 @@ const Tooltip = (($) => { const Default = { animation : true, template : '<div class="tooltip" role="tooltip">' - + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>', trigger : 'hover focus', title : '', diff --git a/scss/_popover.scss b/scss/_popover.scss index 6e6fe3c9c..86b489a48 100644 --- a/scss/_popover.scss +++ b/scss/_popover.scss @@ -25,19 +25,22 @@ &.bs-tether-element-attached-bottom { margin-top: -$popover-arrow-width; - .popover-arrow { - bottom: -$popover-arrow-outer-width; + &::before, + &::after { left: 50%; + border-bottom-width: 0; + } + + &::before { + bottom: -$popover-arrow-outer-width; margin-left: -$popover-arrow-outer-width; border-top-color: $popover-arrow-outer-color; - border-bottom-width: 0; - &::after { - bottom: 1px; - margin-left: -$popover-arrow-width; - content: ""; - border-top-color: $popover-arrow-color; - border-bottom-width: 0; - } + } + + &::after { + bottom: -($popover-arrow-outer-width - 1); + margin-left: -$popover-arrow-width; + border-top-color: $popover-arrow-color; } } @@ -45,19 +48,22 @@ &.bs-tether-element-attached-left { margin-left: $popover-arrow-width; - .popover-arrow { + &::before, + &::after { top: 50%; + border-left-width: 0; + } + + &::before { left: -$popover-arrow-outer-width; margin-top: -$popover-arrow-outer-width; border-right-color: $popover-arrow-outer-color; - border-left-width: 0; - &::after { - bottom: -$popover-arrow-width; - left: 1px; - content: ""; - border-right-color: $popover-arrow-color; - border-left-width: 0; - } + } + + &::after { + left: -($popover-arrow-outer-width - 1); + margin-top: -($popover-arrow-outer-width - 1); + border-right-color: $popover-arrow-color; } } @@ -65,19 +71,34 @@ &.bs-tether-element-attached-top { margin-top: $popover-arrow-width; - .popover-arrow { - top: -$popover-arrow-outer-width; + &::before, + &::after { left: 50%; - margin-left: -$popover-arrow-outer-width; border-top-width: 0; + } + + &::before { + top: -$popover-arrow-outer-width; + margin-left: -$popover-arrow-outer-width; border-bottom-color: $popover-arrow-outer-color; - &::after { - top: 1px; - margin-left: -$popover-arrow-width; - content: ""; - border-top-width: 0; - border-bottom-color: $popover-arrow-color; - } + } + + &::after { + top: -($popover-arrow-outer-width - 1); + margin-left: -$popover-arrow-width; + border-bottom-color: $popover-title-bg; + } + + // This will remove the popover-title's border just below the arrow + .popover-title::before { + position: absolute; + top: 0; + left: 50%; + display: block; + width: 20px; + margin-left: -10px; + content: ""; + border-bottom: 1px solid $popover-title-bg; } } @@ -85,19 +106,22 @@ &.bs-tether-element-attached-right { margin-left: -$popover-arrow-width; - .popover-arrow { + &::before, + &::after { top: 50%; + border-right-width: 0; + } + + &::before { right: -$popover-arrow-outer-width; margin-top: -$popover-arrow-outer-width; - border-right-width: 0; border-left-color: $popover-arrow-outer-color; - &::after { - right: 1px; - bottom: -$popover-arrow-width; - content: ""; - border-right-width: 0; - border-left-color: $popover-arrow-color; - } + } + + &::after { + right: -($popover-arrow-outer-width - 1); + margin-top: -($popover-arrow-outer-width - 1); + border-left-color: $popover-arrow-color; } } } @@ -127,21 +151,21 @@ // // .popover-arrow is outer, .popover-arrow::after is inner -.popover-arrow { - &, - &::after { - position: absolute; - display: block; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - } +.popover::before, +.popover::after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; } -.popover-arrow { + +.popover::before { + content: ""; border-width: $popover-arrow-outer-width; } -.popover-arrow::after { +.popover::after { content: ""; border-width: $popover-arrow-width; } diff --git a/scss/_tooltip.scss b/scss/_tooltip.scss index e8151af07..37d296419 100644 --- a/scss/_tooltip.scss +++ b/scss/_tooltip.scss @@ -18,10 +18,11 @@ padding: $tooltip-arrow-width 0; margin-top: -$tooltip-margin; - .tooltip-arrow { + .tooltip-inner:before { bottom: 0; left: 50%; margin-left: -$tooltip-arrow-width; + content: ""; border-width: $tooltip-arrow-width $tooltip-arrow-width 0; border-top-color: $tooltip-arrow-color; } @@ -31,10 +32,11 @@ padding: 0 $tooltip-arrow-width; margin-left: $tooltip-margin; - .tooltip-arrow { + .tooltip-inner:before { top: 50%; left: 0; margin-top: -$tooltip-arrow-width; + content: ""; border-width: $tooltip-arrow-width $tooltip-arrow-width $tooltip-arrow-width 0; border-right-color: $tooltip-arrow-color; } @@ -44,10 +46,11 @@ padding: $tooltip-arrow-width 0; margin-top: $tooltip-margin; - .tooltip-arrow { + .tooltip-inner:before { top: 0; left: 50%; margin-left: -$tooltip-arrow-width; + content: ""; border-width: 0 $tooltip-arrow-width $tooltip-arrow-width; border-bottom-color: $tooltip-arrow-color; } @@ -57,10 +60,11 @@ padding: 0 $tooltip-arrow-width; margin-left: -$tooltip-margin; - .tooltip-arrow { + .tooltip-inner:before { top: 50%; right: 0; margin-top: -$tooltip-arrow-width; + content: ""; border-width: $tooltip-arrow-width 0 $tooltip-arrow-width $tooltip-arrow-width; border-left-color: $tooltip-arrow-color; } @@ -75,13 +79,12 @@ text-align: center; background-color: $tooltip-bg; @include border-radius($border-radius); -} -// Arrows -.tooltip-arrow { - position: absolute; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; + &:before { + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + } } |
