carousel.less 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. .img-responsive();
  20. line-height: 1;
  21. }
  22. }
  23. > .active,
  24. > .next,
  25. > .prev { display: block; }
  26. > .active {
  27. left: 0;
  28. }
  29. > .next,
  30. > .prev {
  31. position: absolute;
  32. top: 0;
  33. width: 100%;
  34. }
  35. > .next {
  36. left: 100%;
  37. }
  38. > .prev {
  39. left: -100%;
  40. }
  41. > .next.left,
  42. > .prev.right {
  43. left: 0;
  44. }
  45. > .active.left {
  46. left: -100%;
  47. }
  48. > .active.right {
  49. left: 100%;
  50. }
  51. }
  52. // Left/right controls for nav
  53. // ---------------------------
  54. .carousel-control {
  55. position: absolute;
  56. top: 0;
  57. left: 0;
  58. bottom: 0;
  59. width: @carousel-control-width;
  60. .opacity(@carousel-control-opacity);
  61. font-size: @carousel-control-font-size;
  62. color: @carousel-control-color;
  63. text-align: center;
  64. text-shadow: @carousel-text-shadow;
  65. // We can't have this transition here because webkit cancels the carousel
  66. // animation if you trip this while in the middle of another animation.
  67. // Set gradients for backgrounds
  68. &.left {
  69. #gradient > .horizontal(@start-color: rgba(0,0,0,.5); @end-color: rgba(0,0,0,.0001));
  70. }
  71. &.right {
  72. left: auto;
  73. right: 0;
  74. #gradient > .horizontal(@start-color: rgba(0,0,0,.0001); @end-color: rgba(0,0,0,.5));
  75. }
  76. // Hover/focus state
  77. &:hover,
  78. &:focus {
  79. color: @carousel-control-color;
  80. text-decoration: none;
  81. .opacity(.9);
  82. }
  83. // Toggles
  84. .icon-prev,
  85. .icon-next,
  86. .glyphicon-chevron-left,
  87. .glyphicon-chevron-right {
  88. position: absolute;
  89. top: 50%;
  90. left: 50%;
  91. z-index: 5;
  92. display: inline-block;
  93. }
  94. .icon-prev,
  95. .icon-next {
  96. width: 20px;
  97. height: 20px;
  98. margin-top: -10px;
  99. margin-left: -10px;
  100. font-family: serif;
  101. }
  102. .icon-prev {
  103. &:before {
  104. content: '\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
  105. }
  106. }
  107. .icon-next {
  108. &:before {
  109. content: '\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
  110. }
  111. }
  112. }
  113. // Optional indicator pips
  114. //
  115. // Add an unordered list with the following class and add a list item for each
  116. // slide your carousel holds.
  117. .carousel-indicators {
  118. position: absolute;
  119. bottom: 10px;
  120. left: 50%;
  121. z-index: 15;
  122. width: 60%;
  123. margin-left: -30%;
  124. padding-left: 0;
  125. list-style: none;
  126. text-align: center;
  127. li {
  128. display: inline-block;
  129. width: 10px;
  130. height: 10px;
  131. margin: 1px;
  132. text-indent: -999px;
  133. border: 1px solid @carousel-indicator-border-color;
  134. border-radius: 10px;
  135. cursor: pointer;
  136. }
  137. .active {
  138. margin: 0;
  139. width: 12px;
  140. height: 12px;
  141. background-color: @carousel-indicator-active-bg;
  142. }
  143. }
  144. // Optional captions
  145. // -----------------------------
  146. // Hidden by default for smaller viewports
  147. .carousel-caption {
  148. position: absolute;
  149. left: 15%;
  150. right: 15%;
  151. bottom: 20px;
  152. z-index: 10;
  153. padding-top: 20px;
  154. padding-bottom: 20px;
  155. color: @carousel-caption-color;
  156. text-align: center;
  157. text-shadow: @carousel-text-shadow;
  158. & .btn {
  159. text-shadow: none; // No shadow for button elements in carousel-caption
  160. }
  161. }
  162. // Scale up controls for tablets and up
  163. @media screen and (min-width: @screen-tablet) {
  164. // Scale up the controls a smidge
  165. .carousel-control .icon-prev,
  166. .carousel-control .icon-next {
  167. width: 30px;
  168. height: 30px;
  169. margin-top: -15px;
  170. margin-left: -15px;
  171. font-size: 30px;
  172. }
  173. // Show and left align the captions
  174. .carousel-caption {
  175. left: 20%;
  176. right: 20%;
  177. padding-bottom: 30px;
  178. }
  179. // Move up the indicators
  180. .carousel-indicators {
  181. bottom: 20px;
  182. }
  183. }