Skip to content
Advertisement

How to move 3 pics elements using setInterval

In short, I’m trying to make something like this.

enter image description here

Here is my code. I need to use only setInterval and when resuming the pic moving action it starts from the last points not from the first one,

JavaScript

Advertisement

Answer

First of all, you need to define the direction of each images. And then if one reaches to end, change the direction to backward.

To give you the basic workflow, you can refer to the following code.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement