Skip to main content

Search and Top Navigation

#2677 closed bug (fixed)

Opened April 10, 2008 10:30PM UTC

Closed May 09, 2008 04:49PM UTC

Last modified February 26, 2009 12:05PM UTC

[slider] moveTo relative increment

Reported by: hubbardr1 Owned by: joern
Priority: major Milestone: 1.5
Component: ui.core 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 (5)

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.

Changed May 24, 2008 03:39AM UTC by comment:4

milestone: 1.2.4

Milestone 1.2.4 deleted

Changed February 26, 2009 12:05PM UTC by paul comment:5

milestone: → 1.5