javascript - dynamic jquery carousel not working -


i'm creating jquery carousel dynamically hides divs have id slideimg.

the slidenumber can number pulled php page.

i can't figure out i'm doing wrong not show first image when resets.

any appreciated.

jquery(document).ready(function($) {    var slidenumber = $(".slidejson").html();    var slidenumber = parseint(slidenumber);    var animateinterval;  var = 1;  var x = 2;    function animate() {          $("#slideimg" + i).hide();      $("#slideimg" + x).fadein(2000);          if (i == slidenumber) {          = 1;          x=2;      } else {          i++;          x++;      }    }    animateinterval = setinterval(animate, 3000);      })
/* here being able see */  div {    width: 50px;    height: 50px;    display: inline-block;  }  #slideimg1 {    background: #ff0000;  }  #slideimg2 {    background: #00ff00;  }  #slideimg3 {    background: #0000ff;  }
<!-- using div instead of original img-->  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div class="slides" id="slideimg1"></div>  <div class="slides" id="slideimg2"></div>  <div class="slides" id="slideimg3"></div>


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -