_carousel.scss 4.75 KB
Newer Older
1
2
3
4
//
// Carousel
// --------------------------------------------------

5

Mark Otto's avatar
Mark Otto committed
6
// Wrapper for the slide container and indicators
7
.carousel {
8
9
  position: relative;
}
10

11
.carousel-inner {
Mark Otto's avatar
Mark Otto committed
12
  position: relative;
13
14
  overflow: hidden;
  width: 100%;
15

16
  > .item {
17
18
    display: none;
    position: relative;
19
    transition: .6s ease-in-out left;
20

21
22
    // Account for jankitude on images
    > img,
RJ Regenold's avatar
RJ Regenold committed
23
    > a > img {
Mark Otto's avatar
Mark Otto committed
24
      @extend .img-responsive;
25
26
      line-height: 1;
    }
27
28

    // WebKit CSS3 transforms for supported devices
29
    @media all and (transform-3d), (-webkit-transform-3d) {
Mark Otto's avatar
Mark Otto committed
30
31
32
      transition: transform .6s ease-in-out;
      backface-visibility: hidden;
      perspective: 1000;
Mark Otto's avatar
Mark Otto committed
33

Hayden Bleasel's avatar
Hayden Bleasel committed
34
35
      &.next,
      &.active.right {
Mark Otto's avatar
Mark Otto committed
36
        transform: translate3d(100%, 0, 0);
37
38
        left: 0;
      }
Hayden Bleasel's avatar
Hayden Bleasel committed
39
40
      &.prev,
      &.active.left {
Mark Otto's avatar
Mark Otto committed
41
        transform: translate3d(-100%, 0, 0);
42
43
        left: 0;
      }
Hayden Bleasel's avatar
Hayden Bleasel committed
44
45
46
      &.next.left,
      &.prev.right,
      &.active {
Mark Otto's avatar
Mark Otto committed
47
        transform: translate3d(0, 0, 0);
48
49
50
        left: 0;
      }
    }
51
52
  }

53
54
  > .active,
  > .next,
Nick Schonning's avatar
Nick Schonning committed
55
56
57
  > .prev {
    display: block;
  }
58

59
  > .active {
60
61
    left: 0;
  }
62

63
64
  > .next,
  > .prev {
65
66
67
68
69
    position: absolute;
    top: 0;
    width: 100%;
  }

70
  > .next {
71
72
    left: 100%;
  }
73
  > .prev {
74
75
    left: -100%;
  }
76
77
  > .next.left,
  > .prev.right {
78
79
80
    left: 0;
  }

81
  > .active.left {
82
83
    left: -100%;
  }
84
  > .active.right {
85
86
    left: 100%;
  }
87

88
}
89

90
91
92
93
94
// Left/right controls for nav
// ---------------------------

.carousel-control {
  position: absolute;
Mark Otto's avatar
Mark Otto committed
95
96
97
  top: 0;
  left: 0;
  bottom: 0;
Mark Otto's avatar
Mark Otto committed
98
99
100
101
  width: $carousel-control-width;
  opacity: $carousel-control-opacity;
  font-size: $carousel-control-font-size;
  color: $carousel-control-color;
102
  text-align: center;
Mark Otto's avatar
Mark Otto committed
103
  text-shadow: $carousel-text-shadow;
Chris Rebert's avatar
Chris Rebert committed
104
  // We can't have this transition here because WebKit cancels the carousel
105
  // animation if you trip this while in the middle of another animation.
106

Mark Otto's avatar
Mark Otto committed
107
108
  // Set gradients for backgrounds
  &.left {
Mark Otto's avatar
Mark Otto committed
109
    @include gradient-horizontal($start-color: rgba(0,0,0,.5), $end-color: rgba(0,0,0,.0001));
Mark Otto's avatar
Mark Otto committed
110
  }
111
112
  &.right {
    left: auto;
Mark Otto's avatar
Mark Otto committed
113
    right: 0;
Mark Otto's avatar
Mark Otto committed
114
    @include gradient-horizontal($start-color: rgba(0,0,0,.0001), $end-color: rgba(0,0,0,.5));
115
116
  }

117
118
119
  // Hover/focus state
  &:hover,
  &:focus {
120
    outline: 0;
Mark Otto's avatar
Mark Otto committed
121
    color: $carousel-control-color;
122
    text-decoration: none;
123
    opacity: .9;
124
  }
Mark Otto's avatar
Mark Otto committed
125
126

  // Toggles
Mark Otto's avatar
Mark Otto committed
127
  .icon-prev,
Mark Otto's avatar
Mark Otto committed
128
  .icon-next {
Mark Otto's avatar
Mark Otto committed
129
130
131
    position: absolute;
    top: 50%;
    z-index: 5;
Mark Otto's avatar
Mark Otto committed
132
    display: inline-block;
Mark Otto's avatar
Mark Otto committed
133
134
135
136
    width:  20px;
    height: 20px;
    margin-top: -10px;
    font-family: serif;
Mark Otto's avatar
Mark Otto committed
137
    line-height: 1;
138
  }
Mark Otto's avatar
Mark Otto committed
139
  .icon-prev {
140
    left: 50%;
141
    margin-left: -10px;
142
  }
Mark Otto's avatar
Mark Otto committed
143
  .icon-next {
144
    right: 50%;
145
    margin-right: -10px;
146
  }
147
148
  .icon-prev {
    &:before {
149
      content: '\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
150
151
152
153
    }
  }
  .icon-next {
    &:before {
154
      content: '\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
155
156
    }
  }
157
}
Mark Otto's avatar
Mark Otto committed
158

159
// Optional indicator pips
160
//
161
// Add an unordered list with the following class and add a list item for each
162
163
// slide your carousel holds.

164
165
.carousel-indicators {
  position: absolute;
166
  bottom: 10px;
Mark Otto's avatar
Mark Otto committed
167
  left: 50%;
Mark Otto's avatar
Mark Otto committed
168
  z-index: 15;
169
170
  width: 60%;
  margin-left: -30%;
171
  padding-left: 0;
172
  list-style: none;
Mark Otto's avatar
Mark Otto committed
173
  text-align: center;
174
175

  li {
Mark Otto's avatar
Mark Otto committed
176
    display: inline-block;
177
178
179
    width:  10px;
    height: 10px;
    margin: 1px;
180
    text-indent: -999px;
Mark Otto's avatar
Mark Otto committed
181
    border: 1px solid $carousel-indicator-border-color;
182
    border-radius: 10px;
183
    cursor: pointer;
184

185
    // IE9 hack for event handling
186
    //
187
    // Internet Explorer 9 does not support clicks on elements without a set
188
189
190
    // `background-color`. We cannot use `filter` since that's not viewed as a
    // background color by the browser. Thus, a hack is needed.
    background-color: rgba(0,0,0,0); // IE9
191
192
  }
  .active {
193
194
195
    margin: 0;
    width:  12px;
    height: 12px;
Mark Otto's avatar
Mark Otto committed
196
    background-color: $carousel-indicator-active-bg;
197
198
  }
}
199

200
201
202
203
204
// Optional captions
// -----------------------------
// Hidden by default for smaller viewports
.carousel-caption {
  position: absolute;
205
206
  left: 15%;
  right: 15%;
207
  bottom: 20px;
208
  z-index: 10;
209
210
  padding-top: 20px;
  padding-bottom: 20px;
Mark Otto's avatar
Mark Otto committed
211
  color: $carousel-caption-color;
212
  text-align: center;
Mark Otto's avatar
Mark Otto committed
213
214
  text-shadow: $carousel-text-shadow;

215
216
217
  & .btn {
    text-shadow: none; // No shadow for button elements in carousel-caption
  }
218
219
}

220

221
// Scale up controls for tablets and up
Mark Otto's avatar
Mark Otto committed
222
@include media-sm {
223
  // Scale up the controls a smidge
224
225
226
227
228
229
230
231
  .carousel-control {
    .icon-prev,
    .icon-next {
      width: 30px;
      height: 30px;
      margin-top: -15px;
      font-size: 30px;
    }
232
233
234
235
236
237
    .icon-prev {
      margin-left: -15px;
    }
    .icon-next {
      margin-right: -15px;
    }
nextgenthemes's avatar
nextgenthemes committed
238
  }
Mark Otto's avatar
Mark Otto committed
239

240
241
  // Show and left align the captions
  .carousel-caption {
242
243
244
    left: 20%;
    right: 20%;
    padding-bottom: 30px;
245
  }
246
247
248
249
250

  // Move up the indicators
  .carousel-indicators {
    bottom: 20px;
  }
Mark Otto's avatar
Mark Otto committed
251
}