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

206 lines
3.7 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;
}
.carousel-inner {
2012-09-26 14:20:27 -04:00
position: relative;
overflow: hidden;
width: 100%;
> .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 {
.img-responsive();
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: @carousel-control-color;
text-align: center;
2013-07-24 02:48:17 -04:00
text-shadow: @carousel-text-shadow;
2013-07-01 20:32:07 -04: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.
2012-10-01 02:44:23 -04:00
// Set gradients for backgrounds
&.left {
#gradient > .horizontal(@start-color: rgba(0,0,0,.5); @end-color: 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(@start-color: rgba(0,0,0,.0001); @end-color: rgba(0,0,0,.5));
2012-09-26 14:20:27 -04:00
background-color: transparent;
}
// Hover/focus state
&:hover,
&:focus {
color: @carousel-control-color;
text-decoration: none;
.opacity(.9);
}
2012-10-01 02:44:23 -04:00
// Toggles
2013-07-18 03:48:02 -04:00
.glyphicon,
.icon-prev,
.icon-next {
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;
2013-07-27 01:59:21 -04:00
font-family: serif;
2012-10-01 02:44:23 -04:00
}
// Non-glyphicon toggles
.icon-prev {
&:before {
content: '\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
}
}
.icon-next {
&:before {
content: '\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)
}
}
}
2012-10-01 02:44:23 -04:00
// Optional indicator pips
// -----------------------------
.carousel-indicators {
position: absolute;
bottom: 10px;
left: 50%;
2013-05-16 21:29:53 -04:00
z-index: 15;
width: 120px;
margin-left: -60px;
padding-left: 0;
list-style: none;
text-align: center;
li {
display: inline-block;
width: 10px;
height: 10px;
margin: 1px;
text-indent: -999px;
border: 1px solid @carousel-indicator-border-color;
border-radius: 10px;
cursor: pointer;
}
.active {
margin: 0;
width: 12px;
height: 12px;
background-color: @carousel-indicator-active-bg;
}
}
// Optional captions
// -----------------------------
// Hidden by default for smaller viewports
.carousel-caption {
position: absolute;
left: 15%;
right: 15%;
bottom: 20px;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: @carousel-caption-color;
text-align: center;
text-shadow: @carousel-text-shadow;
2013-04-01 09:27:49 -04:00
& .btn {
text-shadow: none; // No shadow for button elements in carousel-caption
}
}
// Scale up controls for tablets and up
@media screen and (min-width: @screen-tablet) {
// Scale up the controls a smidge
.carousel-control .glyphicon,
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 30px;
height: 30px;
margin-top: -15px;
margin-left: -15px;
font-size: 30px;
}
// Show and left align the captions
.carousel-caption {
left: 20%;
right: 20%;
padding-bottom: 30px;
}
// Move up the indicators
.carousel-indicators {
bottom: 20px;
}
}