Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #image #continuous #changing #div
ADD COMMENT
Topic
Name
5+6 =