carousel.less 4.21 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
  }

29
30
  > .active,
  > .next,
Nick Schonning's avatar
Nick Schonning committed
31
32
33
  > .prev {
    display: block;
  }
34

35
  > .active {
36
37
    left: 0;
  }
38

39
40
  > .next,
  > .prev {
41
42
43
44
45
    position: absolute;
    top: 0;
    width: 100%;
  }

46
  > .next {
47
48
    left: 100%;
  }
49
  > .prev {
50
51
    left: -100%;
  }
52
53
  > .next.left,
  > .prev.right {
54
55
56
    left: 0;
  }

57
  > .active.left {
58
59
    left: -100%;
  }
60
  > .active.right {
61
62
    left: 100%;
  }
63

64
}
65

66
67
68
69
70
// Left/right controls for nav
// ---------------------------

.carousel-control {
  position: absolute;
Mark Otto's avatar
Mark Otto committed
71
72
73
  top: 0;
  left: 0;
  bottom: 0;
syed's avatar
syed committed
74
75
76
  width: @carousel-control-width;
  .opacity(@carousel-control-opacity);
  font-size: @carousel-control-font-size;
77
  color: @carousel-control-color;
78
  text-align: center;
Mark Otto's avatar
Mark Otto committed
79
  text-shadow: @carousel-text-shadow;
Chris Rebert's avatar
Chris Rebert committed
80
  // We can't have this transition here because WebKit cancels the carousel
81
  // animation if you trip this while in the middle of another animation.
82

Mark Otto's avatar
Mark Otto committed
83
84
  // Set gradients for backgrounds
  &.left {
Mark Otto's avatar
Mark Otto committed
85
    #gradient > .horizontal(@start-color: rgba(0,0,0,.5); @end-color: rgba(0,0,0,.0001));
Mark Otto's avatar
Mark Otto committed
86
  }
87
88
  &.right {
    left: auto;
Mark Otto's avatar
Mark Otto committed
89
    right: 0;
Mark Otto's avatar
Mark Otto committed
90
    #gradient > .horizontal(@start-color: rgba(0,0,0,.0001); @end-color: rgba(0,0,0,.5));
91
92
  }

93
94
95
  // Hover/focus state
  &:hover,
  &:focus {
96
    outline: 0;
Mark Otto's avatar
Mark Otto committed
97
    color: @carousel-control-color;
98
    text-decoration: none;
99
    .opacity(.9);
100
  }
Mark Otto's avatar
Mark Otto committed
101
102

  // Toggles
Mark Otto's avatar
Mark Otto committed
103
  .icon-prev,
Mark Otto's avatar
Mark Otto committed
104
  .icon-next {
Mark Otto's avatar
Mark Otto committed
105
106
107
    position: absolute;
    top: 50%;
    z-index: 5;
Mark Otto's avatar
Mark Otto committed
108
    display: inline-block;
Mark Otto's avatar
Mark Otto committed
109
110
111
112
    width:  20px;
    height: 20px;
    margin-top: -10px;
    font-family: serif;
113
  }
Mark Otto's avatar
Mark Otto committed
114
  .icon-prev {
115
    left: 50%;
116
    margin-left: -10px;
117
  }
Mark Otto's avatar
Mark Otto committed
118
  .icon-next {
119
    right: 50%;
120
    margin-right: -10px;
121
  }
122

123

124
125
  .icon-prev {
    &:before {
126
      content: '\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
127
128
129
130
    }
  }
  .icon-next {
    &:before {
131
      content: '\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
132
133
    }
  }
134
}
Mark Otto's avatar
Mark Otto committed
135

136
// Optional indicator pips
137
//
138
// Add an unordered list with the following class and add a list item for each
139
140
// slide your carousel holds.

141
142
.carousel-indicators {
  position: absolute;
143
  bottom: 10px;
Mark Otto's avatar
Mark Otto committed
144
  left: 50%;
Mark Otto's avatar
Mark Otto committed
145
  z-index: 15;
146
147
  width: 60%;
  margin-left: -30%;
148
  padding-left: 0;
149
  list-style: none;
Mark Otto's avatar
Mark Otto committed
150
  text-align: center;
151
152

  li {
Mark Otto's avatar
Mark Otto committed
153
    display: inline-block;
154
155
156
    width:  10px;
    height: 10px;
    margin: 1px;
157
    text-indent: -999px;
Mark Otto's avatar
Mark Otto committed
158
    border: 1px solid @carousel-indicator-border-color;
159
    border-radius: 10px;
160
    cursor: pointer;
161

162
    // IE9 hack for event handling
163
    //
164
    // Internet Explorer 9 does not support clicks on elements without a set
165
166
167
    // `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
168
169
  }
  .active {
170
171
172
    margin: 0;
    width:  12px;
    height: 12px;
Mark Otto's avatar
Mark Otto committed
173
    background-color: @carousel-indicator-active-bg;
174
175
  }
}
176

177
178
179
180
181
// Optional captions
// -----------------------------
// Hidden by default for smaller viewports
.carousel-caption {
  position: absolute;
182
183
  left: 15%;
  right: 15%;
184
  bottom: 20px;
185
  z-index: 10;
186
187
  padding-top: 20px;
  padding-bottom: 20px;
188
  color: @carousel-caption-color;
189
  text-align: center;
Mark Otto's avatar
Mark Otto committed
190
  text-shadow: @carousel-text-shadow;
191
192
193
  & .btn {
    text-shadow: none; // No shadow for button elements in carousel-caption
  }
194
195
}

196

197
// Scale up controls for tablets and up
Zlatan Vasović's avatar
Zlatan Vasović committed
198
@media screen and (min-width: @screen-sm-min) {
nextgenthemes's avatar
nextgenthemes committed
199

200
  // Scale up the controls a smidge
201
202
203
204
205
206
207
208
  .carousel-control {
    .icon-prev,
    .icon-next {
      width: 30px;
      height: 30px;
      margin-top: -15px;
      font-size: 30px;
    }
209
210
211
212
213
214
    .icon-prev {
      margin-left: -15px;
    }
    .icon-next {
      margin-right: -15px;
    }
nextgenthemes's avatar
nextgenthemes committed
215
  }
Mark Otto's avatar
Mark Otto committed
216

217
218
  // Show and left align the captions
  .carousel-caption {
219
220
221
    left: 20%;
    right: 20%;
    padding-bottom: 30px;
222
  }
223
224
225
226
227

  // Move up the indicators
  .carousel-indicators {
    bottom: 20px;
  }
228
}