image continuous changing div

Solutions on MaxInterview for image continuous changing div by the best coders in the world

showing results for - "image continuous changing div"
Oscar
17 Aug 2020
1//source : stackoverflow.com
2// change images in a div tag after interval
3
4$(document).ready(function () {
5  var imageFile = ["Image.jpg", "Image1.jpg", "Image2.jpg", "Image4.jpg"];
6  var currentIndex = 0;
7  setInterval(function () {
8    if (currentIndex == imageFile.length) {
9      currentIndex = 0;
10    }
11    $(".topstrip").css('background-image', 'url("/static/img/website/banner/' + imageFile[currentIndex++] + '")');
12  }, 3000);
13});