Brak opisu

carousel.less 5.2KB

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