how can we change background in loop img in webpages

Solutions on MaxInterview for how can we change background in loop img in webpages by the best coders in the world

showing results for - "how can we change background in loop img in webpages"
Amir
04 Sep 2017
1#box {
2background: url("https://priteshgupta.com/wp-content/uploads/2011/06/html-ipsum.png");
3width:200px;
4height:200px;
5margin:50px;
6}
7
Jonah
09 Oct 2016
1var box = document.getElementById('box'),
2imgs = ['/image.jpg', '/image2.jpg'];
3
4box.onclick = function () {
5img = imgs.shift();
6imgs.push(img);
7
8box.style.backgroundImage = img;
9};
10
Daniel
21 Apr 2020
1<div id='box'></div>
2