title: j query Slider timing not working well
body: <p>I am working on a j query slider, the slide automatic change is working well but when I press the "next" or "previous", it does not reset the slide changing time, so sometimes it goes to the next slider, only to have it played and changed in a very small time. How can I fix it?</p>
  
  <pre><code>var slider = $('.slides img');
  slider.hide();
  slider.eq(0).show();
  clickCount = 0;    
  
  //autoplay
  
  $(document).ready(function(){
      setInterval(function(){$(".SlNextBT").click();},6000);
   }) ;  
  
  //next
  
  $(".SlNextBT").click(function(){
       if(clickCount &lt; slider.length)
             slider.eq(clickCount++).fadeOut(2100).hide();
       if(clickCount == slider.length)
           clickCount = 0;
        slider.eq(clickCount).fadeIn(2100).show();
   }) ; 
  
  //previous
  
      $(".SlPreviousBT").click(function(){
           if(clickCount &gt;= 0)
                 slider.eq(clickCount--).fadeOut(2100).hide();                
           if(clickCount &lt; 0)
               clickCount = slider.length-1;
            slider.eq(clickCount).fadeIn(2100).show();
          console.log(clickCount);
       }) ; 
  </code></pre>