moved the percent fixer logic out of the if/else

This commit is contained in:
scottjehl 2010-09-21 16:45:45 -04:00
parent a66fd2f296
commit 8b5a1b0a1f

View file

@ -44,12 +44,12 @@ $.fn.slider = function(options){
return;
}
percent = Math.round(((data.pageX - slider.offset().left) / slider.width() ) * 100);
if( percent < 0 ){ percent = 0; }
if( percent > 100 ){ percent = 100; }
}
else{
percent = parseFloat(val) / (max - min) * 100;
}
if( percent < 0 ){ percent = 0; }
if( percent > 100 ){ percent = 100; }
var newval = Math.round( (percent/100) * max );
if( newval < min ){ newval = min; }
if( newval > max ){ newval = max; }