Animation through images by fadein and fadeout using Javascript and jQuery

I am trying to create slideshow animation where images fade in and fade out one by one. I need help with  jquery script

Kid Asked on December 13, 2015 in Javascript.
Add Comment
  • 1 Answer(s)

      Javascript

      startTimer();
      $(function(){ $(“label”).inFieldLabels(); });

      function displayNextImage() {
      x = (x === images.length – 1) ? 0 : x + 1;
      document.getElementById(“img”).src = images[x];
      }

      function displayPreviousImage() {
      x = (x <= 0) ? images.length – 1 : x – 1;
      document.getElementById(“img”).src = images[x];
      }

      function startTimer() {
      setInterval(displayNextImage, 3000);
      }

      var images = [], x = -1;
      images[0] = “images/imageno1.jpg”;
      images[1] = “images/imageno2.jpg”;
      images[2] = “images/imageno3.jpg”;
      images[3] = “images/imageno4.gif”;
      images[4] = “images/imageno5.jpg”;
      images[5] = "images/imageno6.jpg";

      HTML CODE

      <img id="img"  src="images/ComplyWorks.jpg">

      Kid Answered on December 13, 2015.
      Add Comment

      Your Answer

      By posting your answer, you agree to the privacy policy and terms of service.