Displaying a decimal

DHTML component for the websites that adds vertical and horizontal trackbar capability to the HTML forms similarly to the controls widely used in desktop applications. The position of the handler is translated into the value from specified range and placed in existing input box of the HTML form.

Displaying a decimal

Postby robhillis » Tue Apr 09, 2013 2:13 pm

Is it possible to return a decimal number rather than a whole number with the slider?
robhillis
 
Posts: 2
Joined: Tue Apr 09, 2013 12:31 pm

Re: Displaying a decimal

Postby tigra » Wed Apr 24, 2013 10:46 am

You'll have to modify function f_sliderSetValue inside of slider.js
Replace:
Code: Select all
   // round to closest multiple if step is specified
   if (this.n_step)
      n_value = Math.round((n_value - this.n_minValue) / this.n_step) * this.n_step + this.n_minValue;
   // smooth out the result
   if (n_value % 1)
      n_value = Math.round(n_value * 1e5) / 1e5;

with
Code: Select all
   if (this.n_step)
      n_value = ((n_value - this.n_minValue) / this.n_step) * this.n_step + this.n_minValue;
tigra
Site Admin
 
Posts: 30
Joined: Fri Jun 29, 2012 12:06 pm


Return to Tigra Slider Control Product Family

cron