Actually, what @NietTheDarkAbsol answered is the expected answer: my selector is not valid in CSS (yes, in jQuery).
However, rewriting logic also requires maintaining class relationships. It means:
A. A bi-target measure that does not satisfy the following 4 conditions at the same time should have an opacity of 0:
- .lowerThird- (25 | 50 | 100) .lowerThird-active
- .middleThird- (25 | 50 | 100) .middleThird-active
- .upperThird- (25 | 50 | 100) .upperThird-active
- .bud- (25 | 50 | 100) type BUD-active
The selector in its response creates 0 when at least one of the corresponding -active filters -active not set. Since several -active filters may be available for each label, the solution should have been changed by default by default (i.e., Opacity is 0 by default and will not be 0 if there are additional classes). Sass script is as follows:
.bio-target-measure { @each $lowerThird in 0, 25, 50, 100 { @each $middleThird in 0, 25, 50, 100 { @each $upperThird in 0, 25, 50, 100 { @each $bud in 0, 25, 50, 100 { $lowerThirdClass: '.lowerThird-#{$lowerThird}.lowerThird-active'; $middleThirdClass: '.middleThird-#{$middleThird}.middleThird-active'; $upperThirdClass: '.upperThird-#{$upperThird}.upperThird-active'; $budClass: '.bud-#{$bud}.bud-active'; @if $lowerThird == 0 { $lowerThirdClass: ''; } @if $middleThird == 0 { $middleThirdClass: ''; } @if $upperThird == 0 { $upperThirdClass: ''; } @if $bud == 0 { $budClass: ''; } $sum: $lowerThird + $middleThird + $upperThird + $bud; @if $sum > 50 { $sum: 100; } &
source share