0
How to force an Element to repaint/rerender in js?
I have been working on an element for rotating through content. The classes are assigned correctly, but the element doesnât get repainted. Is there a way to force the repainting? My Code: https://code.sololearn.com/WWoy4s6jtlD1/?ref=app
2 Answers
+ 1
Found the error. I used Integers as Objectkeys and tried to test with index === 1. JavaScript seems to convert them to strings though. Meaning that I should have tested like this: index === "1"
This resulted in a failure while setting the new css class.
0
I didn't take an in-depth look at your code yet but generally speaking you would simply use JavaScript to change the CSS attribute.