No Description
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.

_carousel.scss 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. // Notes on the classes:
  2. //
  3. // 1. The .carousel-item-left and .carousel-item-right is used to indicate where
  4. // the active slide is heading.
  5. // 2. .active.carousel-item is the current slide.
  6. // 3. .active.carousel-item-left and .active.carousel-item-right is the current
  7. // slide in its in-transition state. Only one of these occurs at a time.
  8. // 4. .carousel-item-next.carousel-item-left and .carousel-item-prev.carousel-item-right
  9. // is the upcoming slide in transition.
  10. .carousel {
  11. position: relative;
  12. }
  13. .carousel-inner {
  14. position: relative;
  15. width: 100%;
  16. overflow: hidden;
  17. }
  18. .carousel-item {
  19. position: relative;
  20. display: none;
  21. align-items: center;
  22. width: 100%;
  23. backface-visibility: hidden;
  24. perspective: 1000px;
  25. }
  26. .carousel-item.active,
  27. .carousel-item-next,
  28. .carousel-item-prev {
  29. display: block;
  30. @include transition($carousel-transition);
  31. }
  32. .carousel-item-next,
  33. .carousel-item-prev {
  34. position: absolute;
  35. top: 0;
  36. }
  37. .carousel-item-next.carousel-item-left,
  38. .carousel-item-prev.carousel-item-right {
  39. transform: translateX(0);
  40. @supports (transform-style: preserve-3d) {
  41. transform: translate3d(0, 0, 0);
  42. }
  43. }
  44. .carousel-item-next,
  45. .active.carousel-item-right {
  46. transform: translateX(100%);
  47. @supports (transform-style: preserve-3d) {
  48. transform: translate3d(100%, 0, 0);
  49. }
  50. }
  51. .carousel-item-prev,
  52. .active.carousel-item-left {
  53. transform: translateX(-100%);
  54. @supports (transform-style: preserve-3d) {
  55. transform: translate3d(-100%, 0, 0);
  56. }
  57. }
  58. //
  59. // Alternate transitions
  60. //
  61. .carousel-fade {
  62. .carousel-item {
  63. opacity: 0;
  64. transition-duration: .6s;
  65. transition-property: opacity;
  66. }
  67. .carousel-item.active,
  68. .carousel-item-next.carousel-item-left,
  69. .carousel-item-prev.carousel-item-right {
  70. opacity: 1;
  71. }
  72. .active.carousel-item-left,
  73. .active.carousel-item-right {
  74. opacity: 0;
  75. }
  76. .carousel-item-next,
  77. .carousel-item-prev,
  78. .carousel-item.active,
  79. .active.carousel-item-left,
  80. .active.carousel-item-prev {
  81. transform: translateX(0);
  82. @supports (transform-style: preserve-3d) {
  83. transform: translate3d(0, 0, 0);
  84. }
  85. }
  86. }
  87. //
  88. // Left/right controls for nav
  89. //
  90. .carousel-control-prev,
  91. .carousel-control-next {
  92. position: absolute;
  93. top: 0;
  94. bottom: 0;
  95. // Use flex for alignment (1-3)
  96. display: flex; // 1. allow flex styles
  97. align-items: center; // 2. vertically center contents
  98. justify-content: center; // 3. horizontally center contents
  99. width: $carousel-control-width;
  100. color: $carousel-control-color;
  101. text-align: center;
  102. opacity: $carousel-control-opacity;
  103. // We can't have a transition here because WebKit cancels the carousel
  104. // animation if you trip this while in the middle of another animation.
  105. // Hover/focus state
  106. @include hover-focus {
  107. color: $carousel-control-color;
  108. text-decoration: none;
  109. outline: 0;
  110. opacity: .9;
  111. }
  112. }
  113. .carousel-control-prev {
  114. left: 0;
  115. @if $enable-gradients {
  116. background: linear-gradient(90deg, rgba($black, .25), rgba($black, .001));
  117. }
  118. }
  119. .carousel-control-next {
  120. right: 0;
  121. @if $enable-gradients {
  122. background: linear-gradient(270deg, rgba($black, .25), rgba($black, .001));
  123. }
  124. }
  125. // Icons for within
  126. .carousel-control-prev-icon,
  127. .carousel-control-next-icon {
  128. display: inline-block;
  129. width: $carousel-control-icon-width;
  130. height: $carousel-control-icon-width;
  131. background: transparent no-repeat center center;
  132. background-size: 100% 100%;
  133. }
  134. .carousel-control-prev-icon {
  135. background-image: $carousel-control-prev-icon-bg;
  136. }
  137. .carousel-control-next-icon {
  138. background-image: $carousel-control-next-icon-bg;
  139. }
  140. // Optional indicator pips
  141. //
  142. // Add an ordered list with the following class and add a list item for each
  143. // slide your carousel holds.
  144. .carousel-indicators {
  145. position: absolute;
  146. right: 0;
  147. bottom: 10px;
  148. left: 0;
  149. z-index: 15;
  150. display: flex;
  151. justify-content: center;
  152. padding-left: 0; // override <ol> default
  153. // Use the .carousel-control's width as margin so we don't overlay those
  154. margin-right: $carousel-control-width;
  155. margin-left: $carousel-control-width;
  156. list-style: none;
  157. li {
  158. position: relative;
  159. flex: 0 1 auto;
  160. width: $carousel-indicator-width;
  161. height: $carousel-indicator-height;
  162. margin-right: $carousel-indicator-spacer;
  163. margin-left: $carousel-indicator-spacer;
  164. text-indent: -999px;
  165. cursor: pointer;
  166. background-color: rgba($carousel-indicator-active-bg, .5);
  167. // Use pseudo classes to increase the hit area by 10px on top and bottom.
  168. &::before {
  169. position: absolute;
  170. top: -10px;
  171. left: 0;
  172. display: inline-block;
  173. width: 100%;
  174. height: 10px;
  175. content: "";
  176. }
  177. &::after {
  178. position: absolute;
  179. bottom: -10px;
  180. left: 0;
  181. display: inline-block;
  182. width: 100%;
  183. height: 10px;
  184. content: "";
  185. }
  186. }
  187. .active {
  188. background-color: $carousel-indicator-active-bg;
  189. }
  190. }
  191. // Optional captions
  192. //
  193. //
  194. .carousel-caption {
  195. position: absolute;
  196. right: ((100% - $carousel-caption-width) / 2);
  197. bottom: 20px;
  198. left: ((100% - $carousel-caption-width) / 2);
  199. z-index: 10;
  200. padding-top: 20px;
  201. padding-bottom: 20px;
  202. color: $carousel-caption-color;
  203. text-align: center;
  204. }