Answer the question
In order to leave comments, you need to log in
SCSS get next element of array?
Greetings!
There is an array:
$arrayColors: (
white,
black,
green,
red,
orange
);
List index is 6 but list is only 5 items long for 'nth'
. I understand that he swears that there are no 6 elements in the array, but how then to get the next elements of the array?@each $color in $arrayColors {
$realIndex: index($arrayColors, $color); // настоящий цвет
$nextIndex: nth($arrayColors, ($realIndex + 1)); // следующий цвет
.test-#{$realIndex} {
color: $nextIndex;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question