_carousel.scss 4.77 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
  width: 100%;
14
  overflow: hidden;
15

Chris Rebert's avatar
Chris Rebert committed
16
  > .carousel-item {
17
    position: relative;
18
    display: none;
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 {
36
        left: 0;
37
        transform: translate3d(100%, 0, 0);
38
      }
Hayden Bleasel's avatar
Hayden Bleasel committed
39
40
      &.prev,
      &.active.left {
41
        left: 0;
42
        transform: translate3d(-100%, 0, 0);
43
      }
Hayden Bleasel's avatar
Hayden Bleasel committed
44
45
46
      &.next.left,
      &.prev.right,
      &.active {
47
        left: 0;
48
        transform: translate3d(0, 0, 0);
49
50
      }
    }
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
  top: 0;
  bottom: 0;
97
  left: 0;
Mark Otto's avatar
Mark Otto committed
98
99
100
  width: $carousel-control-width;
  font-size: $carousel-control-font-size;
  color: $carousel-control-color;
101
  text-align: center;
Mark Otto's avatar
Mark Otto committed
102
  text-shadow: $carousel-text-shadow;
103
  opacity: $carousel-control-opacity;
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
  &.right {
Mark Otto's avatar
Mark Otto committed
112
    right: 0;
113
    left: auto;
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 {
Mark Otto's avatar
Mark Otto committed
120
    color: $carousel-control-color;
121
    text-decoration: none;
122
    outline: 0;
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;
133
    width: 20px;
Mark Otto's avatar
Mark Otto committed
134
135
136
    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
  width: 60%;
170
  padding-left: 0;
171
  margin-left: -30%;
Mark Otto's avatar
Mark Otto committed
172
  text-align: center;
173
  list-style: none;
174
175

  li {
Mark Otto's avatar
Mark Otto committed
176
    display: inline-block;
177
    width: 10px;
178
179
    height: 10px;
    margin: 1px;
180
    text-indent: -999px;
181
    cursor: pointer;
182
    // IE9 hack for event handling
183
    //
184
    // Internet Explorer 9 does not support clicks on elements without a set
185
186
187
    // `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
188
189
    border: 1px solid $carousel-indicator-border-color;
    border-radius: 10px;
190
191
  }
  .active {
192
    width: 12px;
193
    height: 12px;
194
    margin: 0;
Mark Otto's avatar
Mark Otto committed
195
    background-color: $carousel-indicator-active-bg;
196
197
  }
}
198

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

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

219

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

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

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