jquery - Slider Widget moveTo, changed into value but gives NaN -


i got following problem

my sliders works not nice anymore , gives errors. because of updates jquery , other things.

i got slider on website (sorry no images yet). got slider , next prev buttons. when click on slider or buttons nice slide comes in front.

this done following code in old way:

initpl_slider = function() {     var steps = math.ceil(parseint(pl.total)/parseint(view[pl.view][0]))-1;     var contentwidth = (parseint($("#pl_content").innerwidth())+100);  $("#pl_slider").slider({         min: 0,         max: (steps*parseint(view[pl.view][0])),         handle: ".pl_handle",         step: parseint(view[pl.view][0]),         change: function(event, ui){             var dir = "";              if(ui.value > pl.limitstart) dir = "-";             pl.limitstart = ui.value;             $("#pl_content").animate({                  left: dir+contentwidth+"px",                 opacity: 0               }, 250, 'linear', function(){                   $("#pl_content").css({left:"0px", opacity:1});                   retrievecontent(false);               }             );         }     });      if(steps < 1){         $("#pl_slider").slider("option", "disabled", true );     }     }  setplmenudata = function(){     var steps = math.ceil(parseint(pl.total)/parseint(view[pl.view][0]))-1;       $("#pl_prev").click(function(){         if(pl.limitstart > 0){             $("#pl_slider").slider("moveto", "-="+view[pl.view][0]);         }     });       $("#pl_next").click(function(){          if(steps > 0){                           if(pl.limitstart < (parseint(view[pl.view][0])*steps)){                 $("#pl_slider").slider("moveto", "+="+view[pl.view][0]);             }         }     }); 

using:

jquery 1.2.6 - new wave javascript

and

jquery ui slider copyright 2008 paul bakaus

but more , more error loading xml data errors , looking solution. first update jquery , jquery ui version:

<script src="//code.jquery.com/jquery-1.11.3.js"></script> <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script src="http://code.jquery.com/ui/1.11.3/jquery-ui.js"></script> 

the error loading xml data errors gone , slider works fine. problem next , prev button. when click, got nan error. seems calculation of limitstart missing. change moveto value, because moveto deprecated.

the link ....&limitstart=nan&limit=25 , new code (value)

    $("#pl_prev").click(function(){         if(pl.limitstart > 0){             $("#pl_slider").slider("value", "-="+view[pl.view][0]);         }     });      $("#pl_next").click(function(){          if(steps > 0){                           if(pl.limitstart < (parseint(view[pl.view][0])*steps)){                 $("#pl_slider").slider("value", "+="+view[pl.view][0]);             }         }     }); 

i lost. how right limitstart calculation in link?

problem solved changing following code.

$("#pl_prev").click(function(){         if(pl.limitstart > 0){             $("#pl_slider").slider("value", "-="+view[pl.view][0]);         }     });      $("#pl_next").click(function(){          if(steps > 0){                           if(pl.limitstart < (parseint(view[pl.view][0])*steps)){                 $("#pl_slider").slider("value", "+="+view[pl.view][0]);             }         }     }); 

into

$("#pl_prev").click(function(){      if(pl.limitstart > 0){         var curr = $("#pl_slider").slider("value");         var thishandle = view[pl.view][0];         $("#pl_slider").slider( "value", curr - thishandle);     } });  $("#pl_next").click(function(){ if(steps > 0){           if(pl.limitstart < (parseint(view[pl.view][0])*steps)){          var curr = $("#pl_slider").slider("value");         var thishandle2 = view[pl.view][0];         $("#pl_slider").slider("value", curr + thishandle2);         }     } }); 

slider value code not complete. since jquery ui 1.7 startvalue , moveto removed in favor of value , values options , methods.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -