Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

slider step, remove round clean up code a bit

  • Loading branch information...
commit 1597d756d8191c4c77483625aa188b8e025745e5 1 parent e09374b
@jrowny jrowny authored johnbender committed
Showing with 5 additions and 5 deletions.
  1. +5 −5 js/jquery.mobile.forms.slider.js
View
10 js/jquery.mobile.forms.slider.js
@@ -255,7 +255,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
cType = control[0].nodeName.toLowerCase(),
min = cType === "input" ? parseFloat( control.attr( "min" ) ) : 0,
max = cType === "input" ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length - 1,
- step = (cType === "input" && parseFloat(control.attr("step"))>0) ? parseFloat(control.attr("step")) : 1;
+ step = (cType === "input" && parseFloat( control.attr( "step" ) ) > 0) ? parseFloat(control.attr("step")) : 1;
if ( typeof val === "object" ) {
var data = val,
@@ -286,17 +286,17 @@ $.widget( "mobile.slider", $.mobile.widget, {
percent = 100;
}
- var newval = Math.round( ( percent / 100 ) * ( max - min ) ) + min;
+ var newval = ( percent / 100 ) * ( max - min ) + min;
//from jQuery UI slider, the following source will round to the neraest step
- var valModStep = (newval - min) % step;
+ var valModStep = ( newval - min ) % step;
var alignValue = newval - valModStep;
- if ( Math.abs(valModStep) * 2 >= step ) {
+ if ( Math.abs( valModStep ) * 2 >= step ) {
alignValue += ( valModStep > 0 ) ? step : ( -step );
}
// Since JavaScript has problems with large floats, round
- // the final value to 5 digits after the decimal point (see jQuery UI: #4124)
+ // the final value to 5 digits after the decimal point (see jQueryUI: #4124)
newval = parseFloat( alignValue.toFixed(5) );
if ( newval < min ) {
Please sign in to comment.
Something went wrong with that request. Please try again.