Animation with setInterval() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Animation with setInterval()

I want to insert classes into each class using the setInterval () list every 300 milliseconds, but what happens is that the error helps me to solve this error and do you have any other way better than what I made? https://code.sololearn.com/WiVqJkLOXbF1/?ref=app

15th Sep 2018, 8:20 AM
Hafizd Jubaidir
Hafizd Jubaidir - avatar
7 Answers
+ 2
I guess I'm not really understanding your design goals for this snippet and I only understood the first part of your post. What do you want the code to do?
15th Sep 2018, 8:24 AM
Janningā­
Janningā­ - avatar
+ 1
I'm not really understand the code so. However there are some errors I noticed, querySelector return a single element, not an array. Maybe you should use querySelectorAll which return all the assigned elements. Other issues are The index of the array is not initialize before use. And the index does not reset based on the array length, would be runtime error when timer increase the index larger then the array length.
15th Sep 2018, 8:56 AM
CalviÕ²
CalviÕ² - avatar
0
Janningā­ I want when the hide menu button is clicked then enter the transhide class into each div that has a class list-menu every 300 millisecond but that doesn't work and results in erorr
15th Sep 2018, 8:33 AM
Hafizd Jubaidir
Hafizd Jubaidir - avatar
0
Not sure if I got what you mean, but here's what I'm picking up: https://www.newmediacampaigns.com/blog/nicer-navigation-with-css-transitions-part-2 (see the View Demo link)
15th Sep 2018, 9:02 AM
Janningā­
Janningā­ - avatar
0
I want to make menu animations like my code https://code.sololearn.com/Ws4bJXu1Mgu6/?ref=app in this code I use animation-delay on css but in this case I want to give animation-delay in javascript using setInterval ()
15th Sep 2018, 9:11 AM
Hafizd Jubaidir
Hafizd Jubaidir - avatar
0
Nifty. :) So you weren't really looking for "any other way better", you're looking specifically to use setInterval()?
15th Sep 2018, 9:20 AM
Janningā­
Janningā­ - avatar
0
nor if there are other better ways I will use them and I learn
15th Sep 2018, 9:22 AM
Hafizd Jubaidir
Hafizd Jubaidir - avatar