Skip to content
Advertisement

Pass url value from background image style property

I have html code below:

JavaScript

Then how to set images/gallery-1.jpg to my imageURL variable javascript by querySelector? This is my try and error:

JavaScript

Advertisement

Answer

A little more code needed

You can change document.querySelector("[data-animate-effect]") to gallery[newIndex].querySelector("li") if preferred

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