Skip to main content

Bug Tracker

Side navigation

#2677 closed bug (fixed)

Opened April 10, 2008 10:30PM UTC

Closed May 09, 2008 04:49PM UTC

Last modified October 14, 2008 10:49AM UTC

[slider] moveTo relative increment

Reported by: hubbardr1 Owned by: joern
Priority: major Milestone: 1.2.4
Component: ui Version:
Keywords: slider moveTo Cc:
Blocked by: Blocking:
Description

using latest 1.5b2 code with jquery-1.2.4a.js.

I've been playing with the moveTo function in order to allow a user to click a "+" or "-" to move the slider 1 step. I have noticed behavior that prevents this when using either(or both) of the 'steps' and 'stepping' options.

With default min (0) and max (100) values, I set 'steps' to 100. I then call a function with .slider('moveTo','+=1'). I would expect that I would click my add function exactly 100 times to get from minValue to maxValue. However, it does not behave that. It seems like moveTo is moving exactly 1 pixel instead of 1 step.

$(document).ready(function(){
	$("#example").slider({ 
	steps:100,
        slide: function(e, ui) { 
			$('#output')[0].innerHTML = ui.value; 
        } 
    }); 
  });
  
  function add1(){
  	$("#example").slider("moveTo","+=1");
  }

Since this was a problem, I also tried the 'stepping' option and set that to 1. I removed the 'steps' option. This worked much better. Starting at 0 I was able to click add 16 times and step 16 times as expected. However, on click 17 the slider stopped. The moveTo function would not add steps until I manually moved the slider to 18 (or higher) with the mouse and handle. Then I could click add another 16 times. Manually moving the slider handle to 17 and then clicking add caused the slider to go back to 16 and stick again. moving to 18 freed me up for another 16 clicks. :)

$(document).ready(function(){
	$("#example").slider({ 
	stepping:1,
        slide: function(e, ui) { 
			$('#output')[0].innerHTML = ui.value; 
        } 
    }); 
  });
Attachments (0)
Change History (3)

Changed April 16, 2008 08:32AM UTC by paul comment:1

owner: pauljoern

Changed May 08, 2008 10:08PM UTC by joern comment:2

summary: Slider moveTo relative increment[slider] moveTo relative increment

Changed May 09, 2008 04:49PM UTC by paul comment:3

resolution: → fixed
status: newclosed

Fixed in r5539.