Skip to content
This repository
Browse code

slider step, remove round clean up code a bit

  • Loading branch information...
commit 1597d756d8191c4c77483625aa188b8e025745e5 1 parent e09374b
Jonathan authored August 12, 2011 johnbender committed November 23, 2011

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. 10  js/jquery.mobile.forms.slider.js
10  js/jquery.mobile.forms.slider.js
@@ -255,7 +255,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
255 255
 			cType = control[0].nodeName.toLowerCase(),
256 256
 			min = cType === "input" ? parseFloat( control.attr( "min" ) ) : 0,
257 257
 			max = cType === "input" ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length - 1,
258  
-			step = (cType === "input" && parseFloat(control.attr("step"))>0) ? parseFloat(control.attr("step")) : 1; 
  258
+			step = (cType === "input" && parseFloat( control.attr( "step" ) ) > 0) ? parseFloat(control.attr("step")) : 1; 
259 259
 			
260 260
 		if ( typeof val === "object" ) {
261 261
 			var data = val,
@@ -286,17 +286,17 @@ $.widget( "mobile.slider", $.mobile.widget, {
286 286
 			percent = 100;
287 287
 		}
288 288
 
289  
-		var newval = Math.round( ( percent / 100 ) * ( max - min ) ) + min;
  289
+		var newval = ( percent / 100 ) * ( max - min ) + min;
290 290
 
291 291
 		//from jQuery UI slider, the following source will round to the neraest step
292  
-		var valModStep = (newval - min) % step;	
  292
+		var valModStep = ( newval - min ) % step;	
293 293
 		var alignValue = newval - valModStep;	
294 294
 
295  
-		if ( Math.abs(valModStep) * 2 >= step ) {
  295
+		if ( Math.abs( valModStep ) * 2 >= step ) {
296 296
 			alignValue += ( valModStep > 0 ) ? step : ( -step );
297 297
 		}
298 298
 		// Since JavaScript has problems with large floats, round
299  
-		// the final value to 5 digits after the decimal point (see jQuery UI: #4124)
  299
+		// the final value to 5 digits after the decimal point (see jQueryUI: #4124)
300 300
 		newval = parseFloat( alignValue.toFixed(5) );
301 301
 
302 302
 		if ( newval < min ) {

0 notes on commit 1597d75

Please sign in to comment.
Something went wrong with that request. Please try again.