_carousel.scss 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. }
  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. @include 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. @include 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. @include 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. outline: none;
  80. color: $carousel-control-color;
  81. text-decoration: none;
  82. @include opacity(.9);
  83. }
  84. // Toggles
  85. .icon-prev,
  86. .icon-next,
  87. .glyphicon-chevron-left,
  88. .glyphicon-chevron-right {
  89. position: absolute;
  90. top: 50%;
  91. z-index: 5;
  92. display: inline-block;
  93. }
  94. .icon-prev,
  95. .glyphicon-chevron-left {
  96. left: 50%;
  97. }
  98. .icon-next,
  99. .glyphicon-chevron-right {
  100. right: 50%;
  101. }
  102. .icon-prev,
  103. .icon-next {
  104. width: 20px;
  105. height: 20px;
  106. margin-top: -10px;
  107. margin-left: -10px;
  108. font-family: serif;
  109. }
  110. .icon-prev {
  111. &:before {
  112. content: '\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
  113. }
  114. }
  115. .icon-next {
  116. &:before {
  117. content: '\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
  118. }
  119. }
  120. }
  121. // Optional indicator pips
  122. //
  123. // Add an unordered list with the following class and add a list item for each
  124. // slide your carousel holds.
  125. .carousel-indicators {
  126. position: absolute;
  127. bottom: 10px;
  128. left: 50%;
  129. z-index: 15;
  130. width: 60%;
  131. margin-left: -30%;
  132. padding-left: 0;
  133. list-style: none;
  134. text-align: center;
  135. li {
  136. display: inline-block;
  137. width: 10px;
  138. height: 10px;
  139. margin: 1px;
  140. text-indent: -999px;
  141. border: 1px solid $carousel-indicator-border-color;
  142. border-radius: 10px;
  143. cursor: pointer;
  144. // IE8-9 hack for event handling
  145. //
  146. // Internet Explorer 8-9 does not support clicks on elements without a set
  147. // `background-color`. We cannot use `filter` since that's not viewed as a
  148. // background color by the browser. Thus, a hack is needed.
  149. //
  150. // For IE8, we set solid black as it doesn't support `rgba()`. For IE9, we
  151. // set alpha transparency for the best results possible.
  152. background-color: #000 \9; // IE8
  153. background-color: rgba(0,0,0,0); // IE9
  154. }
  155. .active {
  156. margin: 0;
  157. width: 12px;
  158. height: 12px;
  159. background-color: $carousel-indicator-active-bg;
  160. }
  161. }
  162. // Optional captions
  163. // -----------------------------
  164. // Hidden by default for smaller viewports
  165. .carousel-caption {
  166. position: absolute;
  167. left: 15%;
  168. right: 15%;
  169. bottom: 20px;
  170. z-index: 10;
  171. padding-top: 20px;
  172. padding-bottom: 20px;
  173. color: $carousel-caption-color;
  174. text-align: center;
  175. text-shadow: $carousel-text-shadow;
  176. & .btn {
  177. text-shadow: none; // No shadow for button elements in carousel-caption
  178. }
  179. }
  180. // Scale up controls for tablets and up
  181. @media screen and (min-width: $screen-sm-min) {
  182. // Scale up the controls a smidge
  183. .carousel-control {
  184. .glyphicon-chevron-left,
  185. .glyphicon-chevron-right,
  186. .icon-prev,
  187. .icon-next {
  188. width: 30px;
  189. height: 30px;
  190. margin-top: -15px;
  191. margin-left: -15px;
  192. font-size: 30px;
  193. }
  194. }
  195. // Show and left align the captions
  196. .carousel-caption {
  197. left: 20%;
  198. right: 20%;
  199. padding-bottom: 30px;
  200. }
  201. // Move up the indicators
  202. .carousel-indicators {
  203. bottom: 20px;
  204. }
  205. }