_tooltips.scss 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // Foundation by ZURB
  2. // foundation.zurb.com
  3. // Licensed under MIT Open Source
  4. @import "global";
  5. //
  6. // Tooltip Variables
  7. //
  8. $include-html-tooltip-classes: $include-html-classes !default;
  9. $has-tip-border-bottom: dotted 1px $iron !default;
  10. $has-tip-font-weight: $font-weight-bold !default;
  11. $has-tip-font-color: $oil !default;
  12. $has-tip-border-bottom-hover: dotted 1px scale-color($primary-color, $lightness: -55%) !default;
  13. $has-tip-font-color-hover: $primary-color !default;
  14. $has-tip-cursor-type: help !default;
  15. $tooltip-padding: rem-calc(12) !default;
  16. $tooltip-bg: $oil !default;
  17. $tooltip-font-size: rem-calc(14) !default;
  18. $tooltip-font-weight: $font-weight-normal !default;
  19. $tooltip-font-color: $white !default;
  20. $tooltip-line-height: 1.3 !default;
  21. $tooltip-close-font-size: rem-calc(10) !default;
  22. $tooltip-close-font-weight: $font-weight-normal !default;
  23. $tooltip-close-font-color: $monsoon !default;
  24. $tooltip-font-size-sml: rem-calc(14) !default;
  25. $tooltip-radius: $global-radius !default;
  26. $tooltip-rounded: $global-rounded !default;
  27. $tooltip-pip-size: 5px !default;
  28. $tooltip-max-width: 300px !default;
  29. @include exports("tooltip") {
  30. @if $include-html-tooltip-classes {
  31. /* Tooltips */
  32. .has-tip {
  33. border-bottom: $has-tip-border-bottom;
  34. cursor: $has-tip-cursor-type;
  35. font-weight: $has-tip-font-weight;
  36. color: $has-tip-font-color;
  37. &:hover,
  38. &:focus {
  39. border-bottom: $has-tip-border-bottom-hover;
  40. color: $has-tip-font-color-hover;
  41. }
  42. &.tip-left,
  43. &.tip-right { float: none !important; }
  44. }
  45. .tooltip {
  46. display: none;
  47. position: absolute;
  48. z-index: 1006;
  49. font-weight: $tooltip-font-weight;
  50. font-size: $tooltip-font-size;
  51. line-height: $tooltip-line-height;
  52. padding: $tooltip-padding;
  53. max-width: $tooltip-max-width;
  54. #{$default-float}: 50%;
  55. width: 100%;
  56. color: $tooltip-font-color;
  57. background: $tooltip-bg;
  58. &>.nub {
  59. display: block;
  60. #{$default-float}: $tooltip-pip-size;
  61. position: absolute;
  62. width: 0;
  63. height: 0;
  64. border: solid $tooltip-pip-size;
  65. border-color: transparent transparent $tooltip-bg transparent;
  66. top: -($tooltip-pip-size * 2);
  67. pointer-events: none;
  68. &.rtl {
  69. left: auto;
  70. #{$opposite-direction}: $tooltip-pip-size;
  71. }
  72. }
  73. &.radius {
  74. @include radius($tooltip-radius);
  75. }
  76. &.round {
  77. @include radius($tooltip-rounded);
  78. &>.nub {
  79. left: 2rem;
  80. }
  81. }
  82. &.opened {
  83. color: $has-tip-font-color-hover !important;
  84. border-bottom: $has-tip-border-bottom-hover !important;
  85. }
  86. }
  87. .tap-to-close {
  88. display: block;
  89. font-size: $tooltip-close-font-size;
  90. color: $tooltip-close-font-color;
  91. font-weight: $tooltip-close-font-weight;
  92. }
  93. @media #{$small} {
  94. .tooltip {
  95. &>.nub {
  96. border-color: transparent transparent $tooltip-bg transparent;
  97. top: -($tooltip-pip-size * 2);
  98. }
  99. &.tip-top>.nub {
  100. border-color: $tooltip-bg transparent transparent transparent;
  101. top: auto;
  102. bottom: -($tooltip-pip-size * 2);
  103. }
  104. &.tip-left,
  105. &.tip-right { float: none !important; }
  106. &.tip-left>.nub {
  107. border-color: transparent transparent transparent $tooltip-bg;
  108. right: -($tooltip-pip-size * 2);
  109. left: auto;
  110. top: 50%;
  111. margin-top: -$tooltip-pip-size;
  112. }
  113. &.tip-right>.nub {
  114. border-color: transparent $tooltip-bg transparent transparent;
  115. right: auto;
  116. left: -($tooltip-pip-size * 2);
  117. top: 50%;
  118. margin-top: -$tooltip-pip-size;
  119. }
  120. }
  121. }
  122. }
  123. }