carousel.less 4.47 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
19
20
    display: none;
    position: relative;
    .transition(.6s ease-in-out left);

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
      .img-responsive();
25
26
      line-height: 1;
    }
27
28
  }

29
30
31
  > .active,
  > .next,
  > .prev { display: block; }
32

33
  > .active {
34
35
    left: 0;
  }
36

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

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

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

62
}
63

64
65
66
67
68
// Left/right controls for nav
// ---------------------------

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

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

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

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

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

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

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

  li {
Mark Otto's avatar
Mark Otto committed
155
    display: inline-block;
156
157
158
    width:  10px;
    height: 10px;
    margin: 1px;
159
    text-indent: -999px;
Mark Otto's avatar
Mark Otto committed
160
    border: 1px solid @carousel-indicator-border-color;
161
    border-radius: 10px;
162
    cursor: pointer;
163
164
165
166
167
168
169
170
171
172
173

    // IE8-9 hack for event handling
    //
    // Internet Explorer 8-9 does not support clicks on elements without a set
    // `background-color`. We cannot use `filter` since that's not viewed as a
    // background color by the browser. Thus, a hack is needed.
    //
    // For IE8, we set solid black as it doesn't support `rgba()`. For IE9, we
    // set alpha transparency for the best results possible.
    background-color: #000 \9; // IE8
    background-color: rgba(0,0,0,0); // IE9
174
175
  }
  .active {
176
177
178
    margin: 0;
    width:  12px;
    height: 12px;
Mark Otto's avatar
Mark Otto committed
179
    background-color: @carousel-indicator-active-bg;
180
181
  }
}
182

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

202

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

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

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

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