_carousel.scss 4.68 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;
Mark Otto's avatar
Mark Otto committed
10
}
11

Mark Otto's avatar
Mark Otto committed
12
13
14
.carousel-item {
  position: relative;
  display: none;
Mark Otto's avatar
Mark Otto committed
15
  width: 100%;
16

Mark Otto's avatar
Mark Otto committed
17
  @include if-supports-3d-transforms() {
18
    @include transition(transform .6s ease-in-out);
Mark Otto's avatar
Mark Otto committed
19
20
    backface-visibility: hidden;
    perspective: 1000px;
21
  }
Mark Otto's avatar
Mark Otto committed
22
}
23

Mark Otto's avatar
Mark Otto committed
24
25
26
27
28
.carousel-item.active,
.carousel-item-next,
.carousel-item-prev {
  display: block;
}
29

Mark Otto's avatar
Mark Otto committed
30
31
.carousel-item-next,
.carousel-item-prev {
Mark Otto's avatar
Mark Otto committed
32
33
34
  position: absolute;
  top: 0;
}
35

Mark Otto's avatar
Mark Otto committed
36
37
38
39
40
41
// CSS3 transforms when supported by the browser
@include if-supports-3d-transforms() {
  .carousel-item-next.carousel-item-left,
  .carousel-item-prev.carousel-item-right {
    transform: translate3d(0, 0, 0);
  }
42

Mark Otto's avatar
Mark Otto committed
43
44
45
46
47
48
49
50
51
  .carousel-item-next,
  .active.carousel-item-right {
    transform: translate3d(100%, 0, 0);
  }

  .carousel-item-prev,
  .active.carousel-item-left {
    transform: translate3d(-100%, 0, 0);
  }
52
}
53

Mark Otto's avatar
Mark Otto committed
54
55

//
56
// Left/right controls for nav
Mark Otto's avatar
Mark Otto committed
57
//
58
59
60

.carousel-control {
  position: absolute;
Mark Otto's avatar
Mark Otto committed
61
62
  top: 0;
  bottom: 0;
63
  left: 0;
Mark Otto's avatar
Mark Otto committed
64
65
66
  width: $carousel-control-width;
  font-size: $carousel-control-font-size;
  color: $carousel-control-color;
67
  text-align: center;
68
  opacity: $carousel-control-opacity;
Chris Rebert's avatar
Chris Rebert committed
69
  // We can't have this transition here because WebKit cancels the carousel
70
  // animation if you trip this while in the middle of another animation.
71

Mark Otto's avatar
Mark Otto committed
72
  // Set gradients for backgrounds
Mark Otto's avatar
Mark Otto committed
73
  &.carousel-control-left {
74
    @include gradient-x($start-color: rgba(0,0,0,.5), $end-color: rgba(0,0,0,.0001));
Mark Otto's avatar
Mark Otto committed
75
  }
Mark Otto's avatar
Mark Otto committed
76

Mark Otto's avatar
Mark Otto committed
77
  &.carousel-control-right {
Mark Otto's avatar
Mark Otto committed
78
    right: 0;
79
    left: auto;
80
    @include gradient-x($start-color: rgba(0,0,0,.0001), $end-color: rgba(0,0,0,.5));
81
82
  }

83
  // Hover/focus state
84
  @include hover-focus {
Mark Otto's avatar
Mark Otto committed
85
    color: $carousel-control-color;
86
    text-decoration: none;
87
    outline: 0;
88
    opacity: .9;
89
  }
Mark Otto's avatar
Mark Otto committed
90
}
Mark Otto's avatar
Mark Otto committed
91

Mark Otto's avatar
Mark Otto committed
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Toggles
.carousel-control-icon-prev,
.carousel-control-icon-next {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: inline-block;
  width: $carousel-icon-width;
  height: $carousel-icon-width;
  margin-top: -($carousel-icon-width / 2);
  font-family: serif;
  line-height: 1;
}
.carousel-control-icon-prev {
  left: 50%;
  margin-left: -($carousel-icon-width / 2);
}
.carousel-control-icon-next {
  right: 50%;
  margin-right: -($carousel-icon-width / 2);
}
113

Mark Otto's avatar
Mark Otto committed
114
115
116
.carousel-control-icon-prev {
  &::before {
    content: "\2039";// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
117
  }
Mark Otto's avatar
Mark Otto committed
118
119
120
121
}
.carousel-control-icon-next {
  &::before {
    content: "\203a";// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
122
  }
123
}
Mark Otto's avatar
Mark Otto committed
124

Mark Otto's avatar
Mark Otto committed
125

126
// Optional indicator pips
127
//
128
// Add an unordered list with the following class and add a list item for each
129
130
// slide your carousel holds.

131
132
.carousel-indicators {
  position: absolute;
133
  bottom: 10px;
Mark Otto's avatar
Mark Otto committed
134
  left: 50%;
Mark Otto's avatar
Mark Otto committed
135
  z-index: 15;
136
  width: $carousel-indicators-width;
137
  padding-left: 0;
138
  margin-left: -($carousel-indicators-width / 2);
Mark Otto's avatar
Mark Otto committed
139
  text-align: center;
140
  list-style: none;
141
142

  li {
Mark Otto's avatar
Mark Otto committed
143
    position: relative;
Mark Otto's avatar
Mark Otto committed
144
    display: inline-block;
Mark Otto's avatar
Mark Otto committed
145
146
    width: $carousel-indicator-width;
    height: $carousel-indicator-height;
147
    text-indent: -999px;
148
    cursor: pointer;
Mark Otto's avatar
Mark Otto committed
149
150
151
152
153
154
155
156
157
    background-color: rgba($carousel-indicator-active-bg, .5);

    &::before {
      position: absolute;
      top: -10px;
      left: 0;
      display: inline-block;
      width: 100%;
      height: 10px;
Mark Otto's avatar
linting    
Mark Otto committed
158
      content: "";
Mark Otto's avatar
Mark Otto committed
159
160
161
162
163
164
165
166
167
    }

    &::after {
      position: absolute;
      bottom: -10px;
      left: 0;
      display: inline-block;
      width: 100%;
      height: 10px;
Mark Otto's avatar
linting    
Mark Otto committed
168
      content: "";
Mark Otto's avatar
Mark Otto committed
169
    }
170
  }
171

172
  .active {
Mark Otto's avatar
Mark Otto committed
173
    background-color: $carousel-indicator-active-bg;
174
175
  }
}
176

Mark Otto's avatar
Mark Otto committed
177

178
// Optional captions
Mark Otto's avatar
Mark Otto committed
179
180
181
//
// Hidden by default for smaller viewports.

182
183
.carousel-caption {
  position: absolute;
184
  right: ((100% - $carousel-caption-width) / 2);
185
  bottom: 20px;
186
  left: ((100% - $carousel-caption-width) / 2);
187
  z-index: 10;
188
189
  padding-top: 20px;
  padding-bottom: 20px;
Mark Otto's avatar
Mark Otto committed
190
  color: $carousel-caption-color;
191
  text-align: center;
192
193
}

194

Mark Otto's avatar
Mark Otto committed
195
196
197
198
//
// Responsive variations
//

199
@include media-breakpoint-up(sm) {
200
  // Scale up the controls a smidge
Mark Otto's avatar
Mark Otto committed
201
202
203
204
205
206
207
208
209
210
211
212
  .carousel-control-icon-prev,
  .carousel-control-icon-next {
    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;
  }
  .carousel-control-icon-prev {
    margin-left: -($carousel-control-sm-up-size / 2);
  }
  .carousel-control-icon-next {
    margin-right: -($carousel-control-sm-up-size / 2);
nextgenthemes's avatar
nextgenthemes committed
213
  }
Mark Otto's avatar
Mark Otto committed
214

215
216
  // Show and left align the captions
  .carousel-caption {
217
218
    right: ((100% - $carousel-caption-sm-up-width) / 2);
    left: ((100% - $carousel-caption-sm-up-width) / 2);
219
    padding-bottom: 30px;
220
  }
221
222
223
224
225

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