How to make a rotary banner in JS with array

Asked

Viewed 303 times

1

I’m starting in JS and would like to make rotating banner by placing the images inside a vector instead of doing as in the code below:

function slide1(){
   document.getElementById("banner").src = "img/banner9.png";
   setTimeout(slide2,1000);
}

function slide2(){
   document.getElementById("banner").src = "img/banner8.png";
   setTimeout(slide1,1000);
}

It would be unfair if I asked you to give me the code, so do you have any guidance where I can research?

1 answer

1


The name is Carousel. I recommend using Slick or the Owl Carousel. They are very light and simple to implement. No need to reinvent the wheel.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.