mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-17 11:01:06 +00:00
moved the percent fixer logic out of the if/else
This commit is contained in:
parent
a66fd2f296
commit
8b5a1b0a1f
1 changed files with 2 additions and 2 deletions
|
|
@ -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; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue