javascript - Slider jQuery not working -


i trying implement basic sliding functionality using jquery, pls find code below:

html:

<div class="dashboard-crousel" id="spancarousel">      <span>my order</span>      <span class="selected">recommendations</span>      <span>my profile</span>      <div id="controls">         <a href="javascript:void(0);" class="dashboard-crouselleftarrow"></a>         <a href="javascript:void(0);" class="dashboard-crouselrightarrow"></a>      </div>  </div> 

javascript:

<script> var slider = {     length: parseint($("#spancarousel").children("span").length),     current: 1,     width: $("#spancarousel").width(),     next: function(){         if(this.current < 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 > 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();   </script> 

enter image description here

i want slide content between arrows shown in image.

i want move text left right endless. pls help

i see 2 mistake in code. since not have css not make working exemple , try out.

the function parseint taking two parameters, string , radix. never putting second parameter.

secondly semi colon missing @ end of programm.

  initialize: function(){     $("#controls .dashboard-crouselleftarrow").click(function(){slider.next();});     $("#controls .dashboard-crouselrightarrow").click(function(){slider.prev();}); }}; 

you might use jsfiddle debbug future code, effective tool.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -