_carousel.scss 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. @include transition(.6s ease-in-out left);
  16. // Account for jankitude on images
  17. > img,
  18. > a > img {
  19. @include img-responsive;
  20. line-height: 1;
  21. }
  22. // WebKit CSS3 transforms for supported devices
  23. @media all and (transform-3d), (-webkit-transform-3d) {
  24. @include transition-transform(0.6s ease-in-out);
  25. @include backface-visibility(hidden);
  26. @include perspective(1000px);
  27. &.next,
  28. &.active.right {
  29. @include translate3d(100%, 0, 0);
  30. left: 0;
  31. }
  32. &.prev,
  33. &.active.left {
  34. @include translate3d(-100%, 0, 0);
  35. left: 0;
  36. }
  37. &.next.left,
  38. &.prev.right,
  39. &.active {
  40. @include 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. @include 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. @include 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. @include 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. @include 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. margin-top: -10px;
  116. z-index: 5;
  117. display: inline-block;
  118. }
  119. .icon-prev,
  120. .glyphicon-chevron-left {
  121. left: 50%;
  122. margin-left: -10px;
  123. }
  124. .icon-next,
  125. .glyphicon-chevron-right {
  126. right: 50%;
  127. margin-right: -10px;
  128. }
  129. .icon-prev,
  130. .icon-next {
  131. width: 20px;
  132. height: 20px;
  133. line-height: 1;
  134. font-family: serif;
  135. }
  136. .icon-prev {
  137. &:before {
  138. content: '\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
  139. }
  140. }
  141. .icon-next {
  142. &:before {
  143. content: '\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
  144. }
  145. }
  146. }
  147. // Optional indicator pips
  148. //
  149. // Add an unordered list with the following class and add a list item for each
  150. // slide your carousel holds.
  151. .carousel-indicators {
  152. position: absolute;
  153. bottom: 10px;
  154. left: 50%;
  155. z-index: 15;
  156. width: 60%;
  157. margin-left: -30%;
  158. padding-left: 0;
  159. list-style: none;
  160. text-align: center;
  161. li {
  162. display: inline-block;
  163. width: 10px;
  164. height: 10px;
  165. margin: 1px;
  166. text-indent: -999px;
  167. border: 1px solid $carousel-indicator-border-color;
  168. border-radius: 10px;
  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. }
  182. .active {
  183. margin: 0;
  184. width: 12px;
  185. height: 12px;
  186. background-color: $carousel-indicator-active-bg;
  187. }
  188. }
  189. // Optional captions
  190. // -----------------------------
  191. // Hidden by default for smaller viewports
  192. .carousel-caption {
  193. position: absolute;
  194. left: 15%;
  195. right: 15%;
  196. bottom: 20px;
  197. z-index: 10;
  198. padding-top: 20px;
  199. padding-bottom: 20px;
  200. color: $carousel-caption-color;
  201. text-align: center;
  202. text-shadow: $carousel-text-shadow;
  203. & .btn {
  204. text-shadow: none; // No shadow for button elements in carousel-caption
  205. }
  206. }
  207. // Scale up controls for tablets and up
  208. @media screen and (min-width: $screen-sm-min) {
  209. // Scale up the controls a smidge
  210. .carousel-control {
  211. .glyphicon-chevron-left,
  212. .glyphicon-chevron-right,
  213. .icon-prev,
  214. .icon-next {
  215. width: 30px;
  216. height: 30px;
  217. margin-top: -15px;
  218. font-size: 30px;
  219. }
  220. .glyphicon-chevron-left,
  221. .icon-prev {
  222. margin-left: -15px;
  223. }
  224. .glyphicon-chevron-right,
  225. .icon-next {
  226. margin-right: -15px;
  227. }
  228. }
  229. // Show and left align the captions
  230. .carousel-caption {
  231. left: 20%;
  232. right: 20%;
  233. padding-bottom: 30px;
  234. }
  235. // Move up the indicators
  236. .carousel-indicators {
  237. bottom: 20px;
  238. }
  239. }