#46 new

Slider error using sliderValue: 0 when range is below zero

Reported by hearsay | July 11th, 2008 @ 02:13 AM

I think that this issue relates to the ticket #27 but it is not the same.

If you set up a slider with a negative to positive range then set the sliderValue to 0 then the slider handle will not be in the correct position it will be in the left most position of the slider.

example code.

function start() {

new Control.Slider( 'handle', 'track', {range: $R(-5, 5), sliderValue: 0} );


Event.observe(window,'load', start);

#track {width: 200px; height: 6px; background: grey;}

#handle{width: 8px; height: 12px; background: red; }

If this code is run in the browser the handle should be in the center of the track but it is all of the way to the left.

I don't know if the example will print as plan text to this can be reproduced by making a slider with a negative to a positive range and a slider value of 0. i.e. use the slider options {range: $R(-5, 5), sliderValue: 0}

Comments and changes to this ticket

  • Radu

    Radu December 4th, 2008 @ 09:06 AM

    • Tag set to slider

    I think the bug is in slider.js, line 79, when initializing the slider value. Making an OR with a slider value of 0 leads to assigning the start range to the slider value. I've eliminated the OR on that line (in my slider.js) and things work fine now (because I've always assign a value to slider.options.sliderValue).

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
<br/><b>Source available from github</b>
The Git repository resides at:
<a href="http://github.com/madrobby/scriptaculous">http://github.com/madrobby/scriptaculous</a>
<br/>Check out the current development trunk with:
<code>git clone git://github.com/madrobby/scriptaculous.git</code>
<br/>As <b>script.aculo.us 1.xx is feature-frozen</b>, this development trunk is for <b>bugfixes only</b>.
<br/>New development should happen only for
<b>script.aculo.us 2</b>.
<br/><b>Creating a bug report</b>
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, <b>alter the unit tests</b> and show through either changed or added tests how the expected behavior is not occuring.

People watching this ticket