diff options
Change Carousels image number to variable #428
2 files changed, 23 insertions, 13 deletions
| -rw-r--r-- | src/_carousels.scss | 34 | ||||
| -rw-r--r-- | src/_viewer-360.scss | 2 |
diff --git a/src/_carousels.scss b/src/_carousels.scss index 5b4eaf5..66dc51b 100644 --- a/src/_carousels.scss +++ b/src/_carousels.scss @@ -1,4 +1,17 @@ // Carousels +// The number of carousel images +$carousel-number: 8; + +%carousel-image-checked { + animation: carousel-slidein .75s ease-in-out 1; + opacity: 1; + z-index: $zindex-1; +} + +%carousel-nav-checked { + color: $gray-color-light; +} + .carousel { background: $bg-color; display: block; @@ -57,19 +70,16 @@ } .carousel-locator { - &:nth-of-type(1):checked ~ .carousel-container .carousel-item:nth-of-type(1), - &:nth-of-type(2):checked ~ .carousel-container .carousel-item:nth-of-type(2), - &:nth-of-type(3):checked ~ .carousel-container .carousel-item:nth-of-type(3), - &:nth-of-type(4):checked ~ .carousel-container .carousel-item:nth-of-type(4) { - animation: carousel-slidein .75s ease-in-out 1; - opacity: 1; - z-index: $zindex-1; + @for $i from 1 through ($carousel-number) { + &:nth-of-type(#{$i}):checked ~ .carousel-container .carousel-item:nth-of-type(#{$i}) { + @extend %carousel-image-checked; + } } - &:nth-of-type(1):checked ~ .carousel-nav .nav-item:nth-of-type(1), - &:nth-of-type(2):checked ~ .carousel-nav .nav-item:nth-of-type(2), - &:nth-of-type(3):checked ~ .carousel-nav .nav-item:nth-of-type(3), - &:nth-of-type(4):checked ~ .carousel-nav .nav-item:nth-of-type(4) { - color: $gray-color-light; + + @for $i from 1 through ($carousel-number) { + &:nth-of-type(#{$i}):checked ~ .carousel-nav .nav-item:nth-of-type(#{$i}) { + @extend %carousel-nav-checked; + } } } diff --git a/src/_viewer-360.scss b/src/_viewer-360.scss index 8d5fd61..332fba4 100644 --- a/src/_viewer-360.scss +++ b/src/_viewer-360.scss @@ -1,5 +1,5 @@ // 360 Degree Viewer -// The number of images options +// The number of images $image-height: 9rem; $image-number: 36 !default; $image-width: 24rem; |