_carousel.scss 5.15 KB
Newer Older
Mark Otto's avatar
Mark Otto committed
1
// Wrapper for the slide container and indicators
2
.carousel {
3
4
  position: relative;
}
5

6
.carousel-inner {
Mark Otto's avatar
Mark Otto committed
7
  position: relative;
8
  width: 100%;
9
  overflow: hidden;
10

Chris Rebert's avatar
Chris Rebert committed
11
  > .carousel-item {
12
    position: relative;
13
    display: none;
14
    transition: .6s ease-in-out left;
15

16
17
    // Account for jankitude on images
    > img,
RJ Regenold's avatar
RJ Regenold committed
18
    > a > img {
19
      @extend .img-fluid;
20
21
      line-height: 1;
    }
22
23

    // WebKit CSS3 transforms for supported devices
24
    @media all and (transform-3d), (-webkit-transform-3d) {
Mark Otto's avatar
Mark Otto committed
25
26
      transition: transform .6s ease-in-out;
      backface-visibility: hidden;
Mark Otto's avatar
Mark Otto committed
27
      perspective: 1000px;
Mark Otto's avatar
Mark Otto committed
28

Hayden Bleasel's avatar
Hayden Bleasel committed
29
30
      &.next,
      &.active.right {
31
        left: 0;
32
        transform: translate3d(100%, 0, 0);
33
      }
Hayden Bleasel's avatar
Hayden Bleasel committed
34
35
      &.prev,
      &.active.left {
36
        left: 0;
37
        transform: translate3d(-100%, 0, 0);
38
      }
Hayden Bleasel's avatar
Hayden Bleasel committed
39
40
41
      &.next.left,
      &.prev.right,
      &.active {
42
        left: 0;
43
        transform: translate3d(0, 0, 0);
44
45
      }
    }
46
47
  }

48
49
  > .active,
  > .next,
Nick Schonning's avatar
Nick Schonning committed
50
51
52
  > .prev {
    display: block;
  }
53

54
  > .active {
55
56
    left: 0;
  }
57

58
59
  > .next,
  > .prev {
60
61
62
63
64
    position: absolute;
    top: 0;
    width: 100%;
  }

65
  > .next {
66
67
    left: 100%;
  }
68
  > .prev {
69
70
    left: -100%;
  }
71
72
  > .next.left,
  > .prev.right {
73
74
75
    left: 0;
  }

76
  > .active.left {
77
78
    left: -100%;
  }
79
  > .active.right {
80
81
82
    left: 100%;
  }
}
83

Mark Otto's avatar
Mark Otto committed
84
85

//
86
// Left/right controls for nav
Mark Otto's avatar
Mark Otto committed
87
//
88
89
90

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

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

113
  // Hover/focus state
114
  @include hover-focus {
Mark Otto's avatar
Mark Otto committed
115
    color: $carousel-control-color;
116
    text-decoration: none;
117
    outline: 0;
118
    opacity: .9;
119
  }
Mark Otto's avatar
Mark Otto committed
120
121

  // Toggles
Mark Otto's avatar
Mark Otto committed
122
  .icon-prev,
Mark Otto's avatar
Mark Otto committed
123
  .icon-next {
Mark Otto's avatar
Mark Otto committed
124
125
126
    position: absolute;
    top: 50%;
    z-index: 5;
Mark Otto's avatar
Mark Otto committed
127
    display: inline-block;
128
    width: 20px;
Mark Otto's avatar
Mark Otto committed
129
130
131
    height: 20px;
    margin-top: -10px;
    font-family: serif;
Mark Otto's avatar
Mark Otto committed
132
    line-height: 1;
133
  }
Mark Otto's avatar
Mark Otto committed
134
  .icon-prev {
135
    left: 50%;
136
    margin-left: -10px;
137
  }
Mark Otto's avatar
Mark Otto committed
138
  .icon-next {
139
    right: 50%;
140
    margin-right: -10px;
141
  }
142

143
  .icon-prev {
144
    &::before {
145
      content: "\2039";// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
146
147
148
    }
  }
  .icon-next {
149
    &::before {
150
      content: "\203a";// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
151
152
    }
  }
153
}
Mark Otto's avatar
Mark Otto committed
154

Mark Otto's avatar
Mark Otto committed
155

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

161
162
.carousel-indicators {
  position: absolute;
163
  bottom: 10px;
Mark Otto's avatar
Mark Otto committed
164
  left: 50%;
Mark Otto's avatar
Mark Otto committed
165
  z-index: 15;
166
  width: $carousel-indicators-width;
167
  padding-left: 0;
168
  margin-left: -($carousel-indicators-width / 2);
Mark Otto's avatar
Mark Otto committed
169
  text-align: center;
170
  list-style: none;
171
172

  li {
Mark Otto's avatar
Mark Otto committed
173
    display: inline-block;
174
175
    width: $carousel-indicator-size;
    height: $carousel-indicator-size;
176
    margin: 1px;
177
    text-indent: -999px;
178
    cursor: pointer;
179
    // IE9 hack for event handling
180
    //
181
    // Internet Explorer 9 does not properly handle clicks on elements with a `background-color` of `transparent`,
182
    // so we use `rgba(0,0,0,0)` instead since it's a non-buggy equivalent.
183
    // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Internet_Explorer
184
    background-color: rgba(0,0,0,0); // IE9
185
    border: 1px solid $carousel-indicator-border-color;
186
    border-radius: $carousel-indicator-size;
187
  }
188

189
  .active {
190
191
    width: $carousel-indicator-active-size;
    height: $carousel-indicator-active-size;
192
    margin: 0;
Mark Otto's avatar
Mark Otto committed
193
    background-color: $carousel-indicator-active-bg;
194
195
  }
}
196

Mark Otto's avatar
Mark Otto committed
197

198
// Optional captions
Mark Otto's avatar
Mark Otto committed
199
200
201
//
// Hidden by default for smaller viewports.

202
203
.carousel-caption {
  position: absolute;
204
  right: ((100% - $carousel-caption-width) / 2);
205
  bottom: 20px;
206
  left: ((100% - $carousel-caption-width) / 2);
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

Mark Otto's avatar
Mark Otto committed
220
221
222
223
//
// Responsive variations
//

224
@include media-breakpoint-up(sm) {
225
  // Scale up the controls a smidge
226
227
228
  .carousel-control {
    .icon-prev,
    .icon-next {
229
230
231
232
      width: $carousel-control-sm-up-size;
      height: $carousel-control-sm-up-size;
      margin-top: -($carousel-control-sm-up-size / 2);
      font-size: $carousel-control-sm-up-size;
233
    }
234
    .icon-prev {
235
      margin-left: -($carousel-control-sm-up-size / 2);
236
237
    }
    .icon-next {
238
      margin-right: -($carousel-control-sm-up-size / 2);
239
    }
nextgenthemes's avatar
nextgenthemes committed
240
  }
Mark Otto's avatar
Mark Otto committed
241

242
243
  // Show and left align the captions
  .carousel-caption {
244
245
    right: ((100% - $carousel-caption-sm-up-width) / 2);
    left: ((100% - $carousel-caption-sm-up-width) / 2);
246
    padding-bottom: 30px;
247
  }
248
249
250
251
252

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