zui
Version:
一个基于 Bootstrap 深度定制开源前端实践方案,帮助你快速构建现代跨屏应用。
194 lines (164 loc) • 3.89 kB
text/less
/// ========================================================================
/// Bootstrap: carousel.less
/// https://github.com/twbs/bootstrap/blob/master/less/carousel.less
///
/// ZUI: The file has been changed in ZUI. It will not keep update with the
/// Bootsrap version in the future.
/// http://openzui.com
/// ========================================================================
/// Bootrap: Copyright 2011-2016 Twitter, Inc. Licensed under MIT
/// ========================================================================
// Core style
// Wrapper for the slide container and indicators
.carousel { position: relative; }
.carousel-inner {
position: relative;
overflow: hidden;
width: 100%;
> .item {
display: none;
position: relative;
.transition(.6s ease-in-out left);
// Account for jankitude on images
> img,
> a > img {
&:extend(.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;
top: 0;
left: 0;
bottom: 0;
width: @carousel-control-width;
.opacity(@carousel-control-opacity);
color: @carousel-control-color;
text-align: center;
text-shadow: @carousel-text-shadow;
outline: none;
> .icon {font-size: @carousel-control-font-size;}
// We can't have this transition here because webkit cancels the carousel
// animation if you trip this while in the middle of another animation.
// Set gradients for backgrounds
&.left {
#gradient > .horizontal(@start-color: rgba(0,0,0,.3); @end-color: rgba(0,0,0,.0001));
}
&.right {
left: auto;
right: 0;
#gradient > .horizontal(@start-color: rgba(0,0,0,.0001); @end-color: rgba(0,0,0,.3));
}
// Hover/focus state
&:hover,
&:focus {
color: @carousel-control-color;
text-decoration: none;
outline: none;
.opacity(1);
}
// Toggles
.icon-prev,
.icon-next,
.icon-chevron-left,
.icon-chevron-right {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
}
.icon-prev,
.icon-chevron-left {
left: 50%;
}
.icon-next,
.icon-chevron-right {
right: 50%;
}
.icon-prev,
.icon-next {
width: 20px;
height: 20px;
margin-top: -10px;
margin-left: -10px;
font-family: serif;
}
.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)
}
}
}
// 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;
& .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 .icon-prev,
.carousel-control .icon-next {
top: 40%;
width: 30px;
height: 30px;
margin-top: -15px;
margin-left: -15px;
font-size: 80px;
}
.carousel-control .icon-prev {
left: 30%;
}
.carousel-control .icon-next {
right: 25%;
}
// Show and left align the captions
.carousel-caption {
left: 20%;
right: 20%;
padding-bottom: 30px;
}
// Move up the indicators
.carousel-indicators {
bottom: 20px;
}
}