_carousel.less 4.72 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 {
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) {
30
      transition: transform .6s ease-in-out;
Mark Otto's avatar
Mark Otto committed
31
32
33
      backface-visibility: hidden;
      perspective: 1000;

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;
syed's avatar
syed committed
98
  width: @carousel-control-width;
99
  opacity: @carousel-control-opacity;
syed's avatar
syed committed
100
  font-size: @carousel-control-font-size;
101
  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
    #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
    #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;
137
  }
Mark Otto's avatar
Mark Otto committed
138
  .icon-prev {
139
    left: 50%;
140
    margin-left: -10px;
141
  }
Mark Otto's avatar
Mark Otto committed
142
  .icon-next {
143
    right: 50%;
144
    margin-right: -10px;
145
  }
146

147

148
149
  .icon-prev {
    &:before {
150
      content: '\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
151
152
153
154
    }
  }
  .icon-next {
    &:before {
155
      content: '\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
156
157
    }
  }
158
}
Mark Otto's avatar
Mark Otto committed
159

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

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

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

186
    // IE9 hack for event handling
187
    //
188
    // Internet Explorer 9 does not support clicks on elements without a set
189
190
191
    // `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
192
193
  }
  .active {
194
195
196
    margin: 0;
    width:  12px;
    height: 12px;
Mark Otto's avatar
Mark Otto committed
197
    background-color: @carousel-indicator-active-bg;
198
199
  }
}
200

201
202
203
204
205
// Optional captions
// -----------------------------
// Hidden by default for smaller viewports
.carousel-caption {
  position: absolute;
206
207
  left: 15%;
  right: 15%;
208
  bottom: 20px;
209
  z-index: 10;
210
211
  padding-top: 20px;
  padding-bottom: 20px;
212
  color: @carousel-caption-color;
213
  text-align: center;
Mark Otto's avatar
Mark Otto committed
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
.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
});