title: Slider jQuery not working
body: <p>I am trying to implement basic sliding functionality using jQuery, pls find the code below:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="dashboard-crousel" id="spanCarousel"&gt;
       &lt;span&gt;My Order&lt;/span&gt;
       &lt;span class="selected"&gt;Recommendations&lt;/span&gt;
       &lt;span&gt;My Profile&lt;/span&gt;
       &lt;div id="controls"&gt;
          &lt;a href="javascript:void(0);" class="dashboard-crouselLeftArrow"&gt;&lt;/a&gt;
          &lt;a href="javascript:void(0);" class="dashboard-crouselRightArrow"&gt;&lt;/a&gt;
       &lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>&lt;script&gt;
  var slider = {
      length: parseInt($("#spanCarousel").children("span").length),
      current: 1,
      width: $("#spanCarousel").width(),
      next: function(){
          if(this.current &lt; this.length){
              this.current = this.current + 1;
              this.animation();
          } else {
              this.current = 1;
              this.animation();
          }
      },
      animation: function(){ 
          var target = (0 - this.width) * (this.current - 1);
          this.run("#spanCarousel", target);
  
      },
      prev: function(){
  
          if(this.current &gt; 1){
              this.current = this.current - 1;
              this.animation();
          } else {
              this.current = this.length;
              this.animation();
          }
      },
      run: function(part, target){
          $(part + " .pan").stop().animate(
              {"margin-left": target},
              1000
          );
      },
      initialize: function(){
          $("#controls .dashboard-crouselLeftArrow").click(function(){slider.next();});
          $("#controls .dashboard-crouselRightArrow").click(function(){slider.prev();});
      }
  }
  
  slider.initialize();  
  &lt;/script&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/5fooQ.jpg" alt="enter image description here"></p>
  
  <p>I just want to slide content between the arrows as shown in the image.</p>
  
  <p>I want to move text left to right endless. pls help</p>