loading...

re: Set CSS styles with javascript VIEW POST

TOP OF THREAD FULL DISCUSSION
re: hey can you maybe help me ? I have some things like this and I just want to Update the hidden class but I Update Complete Style <style id="sty...
 

I'm not 100% sure what you're trying to achieve, but if you need to add animations on an element(s) with JS after some event, consider the following way:

  • Define styles with css like
.hidden {
...
}

.animate {
...
}
  • Add/remove CSS classes with animations when necessary with DOM API: document.querySelectorAll('.hidden').classList.add('animate')
 

Thanks for writing but I just wanted to update an element's CSS with JS.
no more new class I wanted to Edit animation-duration value from JS.
I resolve it thx

code of conduct - report abuse