E
E
Evtera2020-04-26 21:27:21
JavaScript
Evtera, 2020-04-26 21:27:21

How to increment on click event?

Hello. There is a code

for (let index = 0; index < value.length; index++) {
        const slidesWrapper = document.getElementsByClassName("slider__slide")
        slidesWrapper[index].style.backgroundImage =
          `url` +
          `${`(http://api....)`}`;
      }


1) There are 4 columns where pictures from the API are loaded. Is it possible to make it so that when you click on a button, say back / forward, the extreme right or extreme left picture changes.

2) In the code above, when interacting with the increment, one picture does not replace the other, but simply disappears and it turns out that only the remaining columns remain filled.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Pike, 2020-04-27
@AndyPike

Syntax error.
Backticks on the 5th line won't work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question