carousel.less 4.6 KB

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