Messi
Messi

Reputation: 1

How do I switch between images using a timer? (set Interval)

I have this code, and i would like to switch images using a set interval timer. Please help me, thanks!

The code, help me please.

Upvotes: 0

Views: 53

Answers (1)

Ramanlfc
Ramanlfc

Reputation: 8354

in setInterval() you need to pass function reference not call the function yourself.

use :

setInterval(changeImage,1000);

instead of

setInterval(changeImage(),1000);

Upvotes: 2

Related Questions