carousel.less 3.23 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

Mark Otto's avatar
Mark Otto committed
11
// Wrap all slides, but only show the active one
12
.carousel-inner {
Mark Otto's avatar
Mark Otto committed
13
  position: relative;
14
15
16
  overflow: hidden;
  width: 100%;
}
17

Mark Otto's avatar
Mark Otto committed
18
// Immediate parent of all slides
19
.carousel-inner {
20

21
  > .item {
22
23
24
25
    display: none;
    position: relative;
    .transition(.6s ease-in-out left);

26
27
    // Account for jankitude on images
    > img,
RJ Regenold's avatar
RJ Regenold committed
28
    > a > img {
29
30
31
      display: block;
      line-height: 1;
    }
32
33
  }

34
35
36
  > .active,
  > .next,
  > .prev { display: block; }
37

38
  > .active {
39
40
    left: 0;
  }
41

42
43
  > .next,
  > .prev {
44
45
46
47
48
    position: absolute;
    top: 0;
    width: 100%;
  }

49
  > .next {
50
51
    left: 100%;
  }
52
  > .prev {
53
54
    left: -100%;
  }
55
56
  > .next.left,
  > .prev.right {
57
58
59
    left: 0;
  }

60
  > .active.left {
61
62
    left: -100%;
  }
63
  > .active.right {
64
65
    left: 100%;
  }
66

67
}
68

69
70
71
72
73
// Left/right controls for nav
// ---------------------------

.carousel-control {
  position: absolute;
Mark Otto's avatar
Mark Otto committed
74
75
76
  top: 0;
  left: 0;
  bottom: 0;
77
  width: 15%;
78
  .opacity(.5);
79
80
81
82
  font-size: 20px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
Jacob Thornton's avatar
blah    
Jacob Thornton committed
83
84
85
86
87
88
89

  // we can't have this transition here
  // because webkit cancels the carousel
  // animation if you trip this while
  // in the middle of another animation
  // ;_;
  // .transition(opacity .2s linear);
90

Mark Otto's avatar
Mark Otto committed
91
92
  // Set gradients for backgrounds
  &.left {
93
    #gradient > .horizontal(rgba(0,0,0,.5), rgba(0,0,0,.0001));
Mark Otto's avatar
Mark Otto committed
94
95
    background-color: transparent;
  }
96
97
  &.right {
    left: auto;
Mark Otto's avatar
Mark Otto committed
98
    right: 0;
99
    #gradient > .horizontal(rgba(0,0,0,.0001), rgba(0,0,0,.5));
Mark Otto's avatar
Mark Otto committed
100
    background-color: transparent;
101
102
  }

103
104
105
  // Hover/focus state
  &:hover,
  &:focus {
106
    color: #fff;
107
    text-decoration: none;
108
    .opacity(.9);
109
  }
Mark Otto's avatar
Mark Otto committed
110
111

  // Toggles
112
  .glyphicon {
Mark Otto's avatar
Mark Otto committed
113
114
    position: absolute;
    top: 50%;
115
    left: 50%;
Mark Otto's avatar
Mark Otto committed
116
    z-index: 5;
Mark Otto's avatar
Mark Otto committed
117
118
119
120
    display: inline-block;
    width:  20px;
    height: 20px;
    margin-top: -10px;
121
    margin-left: -10px;
Mark Otto's avatar
Mark Otto committed
122
  }
123
}
Mark Otto's avatar
Mark Otto committed
124

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

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

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

172

173
174
// Scale up controls for tablets and up
@media screen and (min-width: @screen-tablet) {
nextgenthemes's avatar
nextgenthemes committed
175

176
177
  // Scale up the controls a smidge
  .carousel-control .glyphicon {
Mark Otto's avatar
Mark Otto committed
178
179
180
    width: 30px;
    height: 30px;
    margin-top: -15px;
181
    margin-left: -15px;
Mark Otto's avatar
Mark Otto committed
182
    font-size: 30px;
nextgenthemes's avatar
nextgenthemes committed
183
  }
Mark Otto's avatar
Mark Otto committed
184

185
186
  // Show and left align the captions
  .carousel-caption {
187
188
189
    left: 20%;
    right: 20%;
    padding-bottom: 30px;
190
  }
191
}