Answers for "image continuous changing div"

0

image continuous changing div

//source : stackoverflow.com
// change images in a div tag after interval

$(document).ready(function () {
  var imageFile = ["Image.jpg", "Image1.jpg", "Image2.jpg", "Image4.jpg"];
  var currentIndex = 0;
  setInterval(function () {
    if (currentIndex == imageFile.length) {
      currentIndex = 0;
    }
    $(".topstrip").css('background-image', 'url("/static/img/website/banner/' + imageFile[currentIndex++] + '")');
  }, 3000);
});
Posted by: Guest on June-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language