_tooltips.scss 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. $multiline-max-width: 250px;
  2. $tooltip-background-color: rgba(0, 0, 0, 0.8);
  3. $tooltip-text-color: #fff;
  4. .tooltipped {
  5. position: relative;
  6. }
  7. // This is the tooltip bubble
  8. .tooltipped:after {
  9. position: absolute;
  10. z-index: 1000000;
  11. display: none;
  12. padding: 5px 8px;
  13. font: normal normal 11px/1.5 $font-family-default;
  14. color: $tooltip-text-color;
  15. text-align: center;
  16. text-decoration: none;
  17. text-shadow: none;
  18. text-transform: none;
  19. letter-spacing: normal;
  20. word-wrap: break-word;
  21. white-space: pre;
  22. pointer-events: none;
  23. content: attr(aria-label);
  24. background: $tooltip-background-color;
  25. border-radius: 3px;
  26. -webkit-font-smoothing: subpixel-antialiased;
  27. }
  28. // This is the tooltip arrow
  29. .tooltipped:before {
  30. position: absolute;
  31. z-index: 1000001;
  32. display: none;
  33. width: 0;
  34. height: 0;
  35. color: $tooltip-background-color;
  36. pointer-events: none;
  37. content: "";
  38. border: 5px solid transparent;
  39. }
  40. // This will indicate when we'll activate the tooltip
  41. .tooltipped:hover,
  42. .tooltipped:active,
  43. .tooltipped:focus {
  44. &:before,
  45. &:after {
  46. display: inline-block;
  47. text-decoration: none;
  48. }
  49. }
  50. // Tooltipped south
  51. .tooltipped-s,
  52. .tooltipped-se,
  53. .tooltipped-sw {
  54. &:after {
  55. top: 100%;
  56. right: 50%;
  57. margin-top: 5px;
  58. }
  59. &:before {
  60. top: auto;
  61. right: 50%;
  62. bottom: -5px;
  63. margin-right: -5px;
  64. border-bottom-color: $tooltip-background-color;
  65. }
  66. }
  67. .tooltipped-se {
  68. &:after {
  69. right: auto;
  70. left: 50%;
  71. margin-left: -15px;
  72. }
  73. }
  74. .tooltipped-sw:after {
  75. margin-right: -15px;
  76. }
  77. // Tooltips above the object
  78. .tooltipped-n,
  79. .tooltipped-ne,
  80. .tooltipped-nw {
  81. &:after {
  82. right: 50%;
  83. bottom: 100%;
  84. margin-bottom: 5px;
  85. }
  86. &:before {
  87. top: -5px;
  88. right: 50%;
  89. bottom: auto;
  90. margin-right: -5px;
  91. border-top-color: $tooltip-background-color;
  92. }
  93. }
  94. .tooltipped-ne {
  95. &:after {
  96. right: auto;
  97. left: 50%;
  98. margin-left: -15px;
  99. }
  100. }
  101. .tooltipped-nw:after {
  102. margin-right: -15px;
  103. }
  104. // Move the tooltip body to the center of the object.
  105. .tooltipped-s:after,
  106. .tooltipped-n:after {
  107. transform: translateX(50%);
  108. }
  109. // Tooltipped to the left
  110. .tooltipped-w {
  111. &:after {
  112. right: 100%;
  113. bottom: 50%;
  114. margin-right: 5px;
  115. transform: translateY(50%);
  116. }
  117. &:before {
  118. top: 50%;
  119. bottom: 50%;
  120. left: -5px;
  121. margin-top: -5px;
  122. border-left-color: $tooltip-background-color;
  123. }
  124. }
  125. // tooltipped to the right
  126. .tooltipped-e {
  127. &:after {
  128. bottom: 50%;
  129. left: 100%;
  130. margin-left: 5px;
  131. transform: translateY(50%);
  132. }
  133. &:before {
  134. top: 50%;
  135. right: -5px;
  136. bottom: 50%;
  137. margin-top: -5px;
  138. border-right-color: $tooltip-background-color;
  139. }
  140. }