1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/less/carousel.less

193 lines
3.2 KiB
Text
Raw Normal View History

2012-06-29 00:46:45 -04:00
//
// Carousel
// --------------------------------------------------
// Wrapper for the slide container and indicators
.carousel {
position: relative;
}
// Wrap all slides, but only show the active one
.carousel-inner {
2012-09-26 14:20:27 -04:00
position: relative;
overflow: hidden;
width: 100%;
}
// Immediate parent of all slides
.carousel-inner {
> .item {
display: none;
position: relative;
.transition(.6s ease-in-out left);
// Account for jankitude on images
> img,
2013-01-31 12:04:12 -05:00
> a > img {
display: block;
line-height: 1;
}
}
> .active,
> .next,
> .prev { display: block; }
> .active {
left: 0;
}
> .next,
> .prev {
position: absolute;
top: 0;
width: 100%;
}
> .next {
left: 100%;
}
> .prev {
left: -100%;
}
> .next.left,
> .prev.right {
left: 0;
}
> .active.left {
left: -100%;
}
> .active.right {
left: 100%;
}
}
// Left/right controls for nav
// ---------------------------
.carousel-control {
position: absolute;
2012-09-26 14:20:27 -04:00
top: 0;
left: 0;
bottom: 0;
width: 15%;
.opacity(.5);
font-size: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0,0,0,.6);
2012-01-28 18:14:57 -05:00
// 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);
2012-10-01 02:44:23 -04:00
// Set gradients for backgrounds
&.left {
#gradient > .horizontal(rgba(0,0,0,.5), rgba(0,0,0,.0001));
2012-10-01 02:44:23 -04:00
background-color: transparent;
}
&.right {
left: auto;
2012-09-26 14:20:27 -04:00
right: 0;
#gradient > .horizontal(rgba(0,0,0,.0001), rgba(0,0,0,.5));
2012-09-26 14:20:27 -04:00
background-color: transparent;
}
// Hover/focus state
&:hover,
&:focus {
2012-11-30 18:05:23 -05:00
color: #fff;
text-decoration: none;
.opacity(.9);
}
2012-10-01 02:44:23 -04:00
// Toggles
.glyphicon {
2012-10-01 02:44:23 -04:00
position: absolute;
top: 50%;
left: 50%;
2012-10-01 02:44:23 -04:00
z-index: 5;
display: inline-block;
width: 20px;
height: 20px;
margin-top: -10px;
margin-left: -10px;
2012-10-01 02:44:23 -04:00
}
}
2012-10-01 02:44:23 -04:00
// Optional indicator pips
// -----------------------------
.carousel-indicators {
position: absolute;
bottom: 20px;
left: 50%;
z-index: 5;
width: 100px;
margin: 0 0 0 -50px;
list-style: none;
text-align: center;
li {
display: inline-block;
width: 8px;
height: 8px;
margin-left: 0;
margin-right: 0;
text-indent: -999px;
border: 1px solid #fff;
border-radius: 5px;
cursor: pointer;
}
.active {
background-color: #fff;
}
}
// Optional captions
// -----------------------------
// Hidden by default for smaller viewports
.carousel-caption {
position: absolute;
left: 20%;
right: 20%;
bottom: 20px;
display: none;
padding-top: 20px;
padding-bottom: 20px;
color: #fff;
text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
// Scale up controls for >768px
@media screen and (min-width: 768px) {
// Scale up the controls a smidge
.carousel-control .glyphicon {
width: 30px;
height: 30px;
margin-top: -15px;
margin-left: -15px;
font-size: 30px;
}
// Show and left align the captions
.carousel-caption {
left: 0;
right: 0;
z-index: 10;
display: block;
max-width: 60%;
padding: 30px;
margin-left: 0;
margin-right: 0;
}
}