carousel.less 3.42 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;
72
  width: 15%;
73
  .opacity(.5);
74
75
76
77
  font-size: 20px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
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
    background-color: transparent;
  }
86
87
  &.right {
    left: auto;
Mark Otto's avatar
Mark Otto committed
88
    right: 0;
Mark Otto's avatar
Mark Otto committed
89
    #gradient > .horizontal(@start-color: rgba(0,0,0,.0001); @end-color: rgba(0,0,0,.5));
Mark Otto's avatar
Mark Otto committed
90
    background-color: transparent;
91
92
  }

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

  // Toggles
102
  .glyphicon, .icon-prev, .icon-next {
Mark Otto's avatar
Mark Otto committed
103
104
    position: absolute;
    top: 50%;
105
    left: 50%;
Mark Otto's avatar
Mark Otto committed
106
    z-index: 5;
Mark Otto's avatar
Mark Otto committed
107
108
109
110
    display: inline-block;
    width:  20px;
    height: 20px;
    margin-top: -10px;
111
    margin-left: -10px;
Mark Otto's avatar
Mark Otto committed
112
  }
113
114
115
116
117
118
119
120
121
122
123
  // Non-glyphicon toggles
  .icon-prev {
    &:before {
      content: '\00ab';
    }
  }
  .icon-next {
    &:before {
      content: '\00bb';
    }
  }
124
}
Mark Otto's avatar
Mark Otto committed
125

126
// Optional indicator pips
127
128
129
// -----------------------------
.carousel-indicators {
  position: absolute;
130
  bottom: 20px;
Mark Otto's avatar
Mark Otto committed
131
  left: 50%;
Mark Otto's avatar
Mark Otto committed
132
  z-index: 15;
Mark Otto's avatar
Mark Otto committed
133
  width: 100px;
134
  margin-left: -50px;
135
  padding-left: 0;
136
  list-style: none;
Mark Otto's avatar
Mark Otto committed
137
  text-align: center;
138
139

  li {
Mark Otto's avatar
Mark Otto committed
140
    display: inline-block;
141
142
143
    width:  10px;
    height: 10px;
    margin: 1px;
144
    text-indent: -999px;
Mark Otto's avatar
Mark Otto committed
145
    border: 1px solid #fff;
146
    border-radius: 10px;
147
    cursor: pointer;
148
149
  }
  .active {
150
151
152
    margin: 0;
    width:  12px;
    height: 12px;
153
154
155
    background-color: #fff;
  }
}
156

157
158
159
160
161
// Optional captions
// -----------------------------
// Hidden by default for smaller viewports
.carousel-caption {
  position: absolute;
162
163
  left: 15%;
  right: 15%;
164
  bottom: 20px;
165
  z-index: 10;
166
167
168
  padding-top: 20px;
  padding-bottom: 20px;
  color: #fff;
169
  text-align: center;
170
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
171
172
173
  & .btn {
    text-shadow: none; // No shadow for button elements in carousel-caption
  }
174
175
}

176

177
178
// Scale up controls for tablets and up
@media screen and (min-width: @screen-tablet) {
nextgenthemes's avatar
nextgenthemes committed
179

180
  // Scale up the controls a smidge
181
182
183
  .carousel-control .glyphicon,
  .carousel-control .icon-prev,
  .carousel-control .icon-next {
Mark Otto's avatar
Mark Otto committed
184
185
186
    width: 30px;
    height: 30px;
    margin-top: -15px;
187
    margin-left: -15px;
Mark Otto's avatar
Mark Otto committed
188
    font-size: 30px;
nextgenthemes's avatar
nextgenthemes committed
189
  }
Mark Otto's avatar
Mark Otto committed
190

191
192
  // Show and left align the captions
  .carousel-caption {
193
194
195
    left: 20%;
    right: 20%;
    padding-bottom: 30px;
196
  }
197
}