You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
5.5 KiB

  1. // Notes on the classes:
  2. //
  3. // 1. .carousel.pointer-event should ideally be pan-y (to allow for users to scroll vertically)
  4. // even when their scroll action started on a carousel, but for compatibility (with Firefox)
  5. // we're preventing all actions instead
  6. // 2. The .carousel-item-start and .carousel-item-end is used to indicate where
  7. // the active slide is heading.
  8. // 3. .active.carousel-item is the current slide.
  9. // 4. .active.carousel-item-start and .active.carousel-item-end is the current
  10. // slide in its in-transition state. Only one of these occurs at a time.
  11. // 5. .carousel-item-next.carousel-item-start and .carousel-item-prev.carousel-item-end
  12. // is the upcoming slide in transition.
  13. .carousel {
  14. position: relative;
  15. }
  16. .carousel.pointer-event {
  17. touch-action: pan-y;
  18. }
  19. .carousel-inner {
  20. position: relative;
  21. width: 100%;
  22. overflow: hidden;
  23. @include clearfix();
  24. }
  25. .carousel-item {
  26. position: relative;
  27. display: none;
  28. float: left;
  29. width: 100%;
  30. margin-right: -100%;
  31. backface-visibility: hidden;
  32. @include transition($carousel-transition);
  33. }
  34. .carousel-item.active,
  35. .carousel-item-next,
  36. .carousel-item-prev {
  37. display: block;
  38. }
  39. /* rtl:begin:ignore */
  40. .carousel-item-next:not(.carousel-item-start),
  41. .active.carousel-item-end {
  42. transform: translateX(100%);
  43. }
  44. .carousel-item-prev:not(.carousel-item-end),
  45. .active.carousel-item-start {
  46. transform: translateX(-100%);
  47. }
  48. /* rtl:end:ignore */
  49. //
  50. // Alternate transitions
  51. //
  52. .carousel-fade {
  53. .carousel-item {
  54. opacity: 0;
  55. transition-property: opacity;
  56. transform: none;
  57. }
  58. .carousel-item.active,
  59. .carousel-item-next.carousel-item-start,
  60. .carousel-item-prev.carousel-item-end {
  61. z-index: 1;
  62. opacity: 1;
  63. }
  64. .active.carousel-item-start,
  65. .active.carousel-item-end {
  66. z-index: 0;
  67. opacity: 0;
  68. @include transition(opacity 0s $carousel-transition-duration);
  69. }
  70. }
  71. //
  72. // Left/right controls for nav
  73. //
  74. .carousel-control-prev,
  75. .carousel-control-next {
  76. position: absolute;
  77. top: 0;
  78. bottom: 0;
  79. z-index: 1;
  80. // Use flex for alignment (1-3)
  81. display: flex; // 1. allow flex styles
  82. align-items: center; // 2. vertically center contents
  83. justify-content: center; // 3. horizontally center contents
  84. width: $carousel-control-width;
  85. padding: 0;
  86. color: $carousel-control-color;
  87. text-align: center;
  88. background: none;
  89. border: 0;
  90. opacity: $carousel-control-opacity;
  91. @include transition($carousel-control-transition);
  92. // Hover/focus state
  93. &:hover,
  94. &:focus {
  95. color: $carousel-control-color;
  96. text-decoration: none;
  97. outline: 0;
  98. opacity: $carousel-control-hover-opacity;
  99. }
  100. }
  101. .carousel-control-prev {
  102. left: 0;
  103. background-image: if($enable-gradients, linear-gradient(90deg, rgba($black, .25), rgba($black, .001)), null);
  104. }
  105. .carousel-control-next {
  106. right: 0;
  107. background-image: if($enable-gradients, linear-gradient(270deg, rgba($black, .25), rgba($black, .001)), null);
  108. }
  109. // Icons for within
  110. .carousel-control-prev-icon,
  111. .carousel-control-next-icon {
  112. display: inline-block;
  113. width: $carousel-control-icon-width;
  114. height: $carousel-control-icon-width;
  115. background-repeat: no-repeat;
  116. background-position: 50%;
  117. background-size: 100% 100%;
  118. }
  119. /* rtl:options: {
  120. "autoRename": true,
  121. "stringMap":[ {
  122. "name" : "prev-next",
  123. "search" : "prev",
  124. "replace" : "next"
  125. } ]
  126. } */
  127. .carousel-control-prev-icon {
  128. background-image: escape-svg($carousel-control-prev-icon-bg);
  129. }
  130. .carousel-control-next-icon {
  131. background-image: escape-svg($carousel-control-next-icon-bg);
  132. }
  133. // Optional indicator pips/controls
  134. //
  135. // Add a container (such as a list) with the following class and add an item (ideally a focusable control,
  136. // like a button) with data-bs-target for each slide your carousel holds.
  137. .carousel-indicators {
  138. position: absolute;
  139. right: 0;
  140. bottom: 0;
  141. left: 0;
  142. z-index: 2;
  143. display: flex;
  144. justify-content: center;
  145. padding: 0;
  146. // Use the .carousel-control's width as margin so we don't overlay those
  147. margin-right: $carousel-control-width;
  148. margin-bottom: 1rem;
  149. margin-left: $carousel-control-width;
  150. list-style: none;
  151. [data-bs-target] {
  152. box-sizing: content-box;
  153. flex: 0 1 auto;
  154. width: $carousel-indicator-width;
  155. height: $carousel-indicator-height;
  156. padding: 0;
  157. margin-right: $carousel-indicator-spacer;
  158. margin-left: $carousel-indicator-spacer;
  159. text-indent: -999px;
  160. cursor: pointer;
  161. background-color: $carousel-indicator-active-bg;
  162. background-clip: padding-box;
  163. border: 0;
  164. // Use transparent borders to increase the hit area by 10px on top and bottom.
  165. border-top: $carousel-indicator-hit-area-height solid transparent;
  166. border-bottom: $carousel-indicator-hit-area-height solid transparent;
  167. opacity: $carousel-indicator-opacity;
  168. @include transition($carousel-indicator-transition);
  169. }
  170. .active {
  171. opacity: $carousel-indicator-active-opacity;
  172. }
  173. }
  174. // Optional captions
  175. //
  176. //
  177. .carousel-caption {
  178. position: absolute;
  179. right: (100% - $carousel-caption-width) * .5;
  180. bottom: $carousel-caption-spacer;
  181. left: (100% - $carousel-caption-width) * .5;
  182. padding-top: $carousel-caption-padding-y;
  183. padding-bottom: $carousel-caption-padding-y;
  184. color: $carousel-caption-color;
  185. text-align: center;
  186. }
  187. // Dark mode carousel
  188. .carousel-dark {
  189. .carousel-control-prev-icon,
  190. .carousel-control-next-icon {
  191. filter: $carousel-dark-control-icon-filter;
  192. }
  193. .carousel-indicators [data-bs-target] {
  194. background-color: $carousel-dark-indicator-active-bg;
  195. }
  196. .carousel-caption {
  197. color: $carousel-dark-caption-color;
  198. }
  199. }