amis/scss/components/_carousel.scss

168 lines
3.0 KiB
SCSS
Raw Normal View History

2019-05-16 11:04:55 +08:00
@mixin arrow-control {
2019-12-06 09:58:08 +08:00
width: 10%;
min-width: $Carousel-arrowControl-width;
height: 100%;
cursor: pointer;
position: absolute;
transition-duration: $Carousel-transitionDuration;
svg {
2019-05-16 11:04:55 +08:00
position: absolute;
2019-12-06 09:58:08 +08:00
top: 50%;
left: 50%;
right: 50%;
transform: translate(-50%, -50%);
width: $Carousel-svg-width;
height: $Carousel-svg-height;
}
2019-05-16 16:31:20 +08:00
}
.#{$ns}Carousel {
2019-12-06 09:58:08 +08:00
min-width: $Carousel-minWidth;
height: $Carousel-height;
position: relative;
display: block;
background: $Carousel-bg;
&.#{$ns}Carousel--light {
.#{$ns}Carousel-dot {
background-color: $Carousel--light-control;
2019-05-16 11:04:55 +08:00
}
2019-12-06 09:58:08 +08:00
svg {
fill: $Carousel--light-control;
}
2019-05-16 11:04:55 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Carousel-item {
.title,
.description {
color: $Carousel--light-control;
}
2019-05-16 11:04:55 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-05-16 11:04:55 +08:00
2019-12-06 09:58:08 +08:00
&.#{$ns}Carousel--dark {
.#{$ns}Carousel-dot {
background-color: $Carousel--dark-control;
}
2019-05-16 11:04:55 +08:00
2019-12-06 09:58:08 +08:00
svg {
fill: $Carousel--dark-control;
2019-05-16 11:04:55 +08:00
}
2019-12-06 09:58:08 +08:00
.#{$ns}Carousel-item {
.title,
.description {
color: $Carousel--dark-control;
}
}
}
&-container {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
.#{$ns}Carousel-item {
width: 100%;
height: 100%;
position: absolute;
transition: ease-out all $Carousel-transitionDuration;
&.fade {
opacity: 0;
}
&.fade.in {
opacity: 1;
}
&.slide {
transform: translateX(100%);
}
&.slide.in {
transform: translateX(0);
}
&.slide.out {
transform: translateX(-100%);
}
&.slideRight {
transform: translateX(-100%);
}
&.slideRight.in {
transform: translateX(0);
}
&.slideRight.out {
transform: translateX(100%);
}
.title {
2019-05-16 11:04:55 +08:00
position: absolute;
2019-12-06 09:58:08 +08:00
bottom: $Carousel-imageTitle-bottom;
text-align: center;
2019-05-16 11:04:55 +08:00
width: 100%;
2019-12-06 09:58:08 +08:00
opacity: 0.8;
}
.description {
position: absolute;
bottom: $Carousel-imageDescription-bottom;
2019-05-16 11:04:55 +08:00
text-align: center;
2019-12-06 09:58:08 +08:00
width: 100%;
opacity: 0.8;
}
2019-05-16 11:04:55 +08:00
2019-12-06 09:58:08 +08:00
.image {
width: 100%;
height: 100%;
background-size: cover;
}
}
}
&-dotsControl {
position: absolute;
bottom: 0px;
width: 100%;
z-index: 100;
text-align: center;
.#{$ns}Carousel-dot {
display: inline-block;
height: $Carousel-dot-width;
width: $Carousel-dot-height;
border-radius: $Carousel-dot-borderRadius;
margin: $Carousel-dot-margin;
transition-duration: $Carousel-transitionDuration;
opacity: 0.3;
&.is-active {
opacity: 1;
}
}
}
2019-05-16 11:04:55 +08:00
2019-12-06 09:58:08 +08:00
&-arrowsControl {
position: absolute;
width: 100%;
height: inherit;
z-index: 100;
text-align: center;
.#{$ns}Carousel-leftArrow {
@include arrow-control;
left: 0;
2019-05-16 11:04:55 +08:00
}
2019-12-06 09:58:08 +08:00
.#{$ns}Carousel-rightArrow {
@include arrow-control;
right: 0;
}
}
}