How can i make carousel automatic | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

How can i make carousel automatic

I can make manual carousel with button but I want to make it automatic like a slideshow.

24th Mar 2020, 1:58 AM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
4 Answers
+ 2
For example, you have a button to move carousel to right, ok? But that button is clicked by user. Well you can make it a function and put into a setInterval
24th Mar 2020, 3:13 AM
Carlos Martinez
Carlos Martinez - avatar
+ 1
You can use setInterval , that executes a code every so often. javascript docs https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval or you also can use CSS animations https://www.w3schools.com/css/css3_animations.asp
24th Mar 2020, 2:52 AM
Carlos Martinez
Carlos Martinez - avatar
+ 1
Plz tell in detail how to set interval
24th Mar 2020, 2:54 AM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
24th Mar 2020, 3:16 AM
Carlos Martinez
Carlos Martinez - avatar