carousel.less 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. // stylelint-disable media-feature-name-no-unknown
  2. //
  3. // Carousel
  4. // --------------------------------------------------
  5. // Wrapper for the slide container and indicators
  6. .carousel {
  7. position: relative;
  8. }
  9. .carousel-inner {
  10. position: relative;
  11. width: 100%;
  12. overflow: hidden;
  13. > .item {
  14. position: relative;
  15. display: none;
  16. .transition(.6s ease-in-out left);
  17. // Account for jankitude on images
  18. > img,
  19. > a > img {
  20. &:extend(.img-responsive);
  21. line-height: 1;
  22. }
  23. // WebKit CSS3 transforms for supported devices
  24. @media all and (transform-3d), (-webkit-transform-3d) {
  25. .transition-transform(~"0.6s ease-in-out");
  26. .backface-visibility(~"hidden");
  27. .perspective(1000px);
  28. &.next,
  29. &.active.right {
  30. .translate3d(100%, 0, 0);
  31. left: 0;
  32. }
  33. &.prev,
  34. &.active.left {
  35. .translate3d(-100%, 0, 0);
  36. left: 0;
  37. }
  38. &.next.left,
  39. &.prev.right,
  40. &.active {
  41. .translate3d(0, 0, 0);
  42. left: 0;
  43. }
  44. }
  45. }
  46. > .active,
  47. > .next,
  48. > .prev {
  49. display: block;
  50. }
  51. > .active {
  52. left: 0;
  53. }
  54. > .next,
  55. > .prev {
  56. position: absolute;
  57. top: 0;
  58. width: 100%;
  59. }
  60. > .next {
  61. left: 100%;
  62. }
  63. > .prev {
  64. left: -100%;
  65. }
  66. > .next.left,
  67. > .prev.right {
  68. left: 0;
  69. }
  70. > .active.left {
  71. left: -100%;
  72. }
  73. > .active.right {
  74. left: 100%;
  75. }
  76. }
  77. // Left/right controls for nav
  78. // ---------------------------
  79. .carousel-control {
  80. position: absolute;
  81. top: 0;
  82. bottom: 0;
  83. left: 0;
  84. width: @carousel-control-width;
  85. font-size: @carousel-control-font-size;
  86. color: @carousel-control-color;
  87. text-align: center;
  88. text-shadow: @carousel-text-shadow;
  89. background-color: rgba(0, 0, 0, 0); // Fix IE9 click-thru bug
  90. .opacity(@carousel-control-opacity);
  91. // We can't have this transition here because WebKit cancels the carousel
  92. // animation if you trip this while in the middle of another animation.
  93. // Set gradients for backgrounds
  94. &.left {
  95. #gradient > .horizontal(@start-color: rgba(0, 0, 0, .5); @end-color: rgba(0, 0, 0, .0001));
  96. }
  97. &.right {
  98. right: 0;
  99. left: auto;
  100. #gradient > .horizontal(@start-color: rgba(0, 0, 0, .0001); @end-color: rgba(0, 0, 0, .5));
  101. }
  102. // Hover/focus state
  103. &:hover,
  104. &:focus {
  105. color: @carousel-control-color;
  106. text-decoration: none;
  107. outline: 0;
  108. .opacity(.9);
  109. }
  110. // Toggles
  111. .icon-prev,
  112. .icon-next,
  113. .glyphicon-chevron-left,
  114. .glyphicon-chevron-right {
  115. position: absolute;
  116. top: 50%;
  117. z-index: 5;
  118. display: inline-block;
  119. margin-top: -10px;
  120. }
  121. .icon-prev,
  122. .glyphicon-chevron-left {
  123. left: 50%;
  124. margin-left: -10px;
  125. }
  126. .icon-next,
  127. .glyphicon-chevron-right {
  128. right: 50%;
  129. margin-right: -10px;
  130. }
  131. .icon-prev,
  132. .icon-next {
  133. width: 20px;
  134. height: 20px;
  135. font-family: serif;
  136. line-height: 1;
  137. }
  138. .icon-prev {
  139. &:before {
  140. content: "\2039";// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
  141. }
  142. }
  143. .icon-next {
  144. &:before {
  145. content: "\203a";// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
  146. }
  147. }
  148. }
  149. // Optional indicator pips
  150. //
  151. // Add an unordered list with the following class and add a list item for each
  152. // slide your carousel holds.
  153. .carousel-indicators {
  154. position: absolute;
  155. bottom: 10px;
  156. left: 50%;
  157. z-index: 15;
  158. width: 60%;
  159. padding-left: 0;
  160. margin-left: -30%;
  161. text-align: center;
  162. list-style: none;
  163. li {
  164. display: inline-block;
  165. width: 10px;
  166. height: 10px;
  167. margin: 1px;
  168. text-indent: -999px;
  169. cursor: pointer;
  170. // IE8-9 hack for event handling
  171. //
  172. // Internet Explorer 8-9 does not support clicks on elements without a set
  173. // `background-color`. We cannot use `filter` since that's not viewed as a
  174. // background color by the browser. Thus, a hack is needed.
  175. // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Internet_Explorer
  176. //
  177. // For IE8, we set solid black as it doesn't support `rgba()`. For IE9, we
  178. // set alpha transparency for the best results possible.
  179. background-color: #000 \9; // IE8
  180. background-color: rgba(0, 0, 0, 0); // IE9
  181. border: 1px solid @carousel-indicator-border-color;
  182. border-radius: 10px;
  183. }
  184. .active {
  185. width: 12px;
  186. height: 12px;
  187. margin: 0;
  188. background-color: @carousel-indicator-active-bg;
  189. }
  190. }
  191. // Optional captions
  192. // -----------------------------
  193. // Hidden by default for smaller viewports
  194. .carousel-caption {
  195. position: absolute;
  196. right: 15%;
  197. bottom: 20px;
  198. left: 15%;
  199. z-index: 10;
  200. padding-top: 20px;
  201. padding-bottom: 20px;
  202. color: @carousel-caption-color;
  203. text-align: center;
  204. text-shadow: @carousel-text-shadow;
  205. & .btn {
  206. text-shadow: none; // No shadow for button elements in carousel-caption
  207. }
  208. }
  209. // Scale up controls for tablets and up
  210. @media screen and (min-width: @screen-sm-min) {
  211. // Scale up the controls a smidge
  212. .carousel-control {
  213. .glyphicon-chevron-left,
  214. .glyphicon-chevron-right,
  215. .icon-prev,
  216. .icon-next {
  217. width: (@carousel-control-font-size * 1.5);
  218. height: (@carousel-control-font-size * 1.5);
  219. margin-top: (@carousel-control-font-size / -2);
  220. font-size: (@carousel-control-font-size * 1.5);
  221. }
  222. .glyphicon-chevron-left,
  223. .icon-prev {
  224. margin-left: (@carousel-control-font-size / -2);
  225. }
  226. .glyphicon-chevron-right,
  227. .icon-next {
  228. margin-right: (@carousel-control-font-size / -2);
  229. }
  230. }
  231. // Show and left align the captions
  232. .carousel-caption {
  233. right: 20%;
  234. left: 20%;
  235. padding-bottom: 30px;
  236. }
  237. // Move up the indicators
  238. .carousel-indicators {
  239. bottom: 20px;
  240. }
  241. }