Reputation: 1600
I have got problem in applying z-index through dart. Whats the correct way to do this
var carousel = query(".carousel");
var classList = [];
carousel.children.forEach(
(childElement) => childElement.classes.forEach(
(className) => classList.add(className)
));
for (var i = 0; i < classList.length; i++) {
query(classList[i]).style.zIndex+=1; //Need to increment z-index value for
the child divs incrementally
}
Upvotes: 1
Views: 223
Reputation: 21383
zIndex is a String so you can't increment it directly.
You can try this instead:
var elem = query(".${classList[i]}");
var newIndex = int.parse(elem.style.zIndex) + 1;
elem.style.zIndex = "${newIndex}";
Upvotes: 2