Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#2677 closed bug (fixed)

[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; 
        } 
    }); 
  });

Change History (3)

comment:1 Changed 12 years ago by paul

Owner: changed from paul to joern

comment:2 Changed 12 years ago by joern

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

comment:3 Changed 12 years ago by paul

Resolution: fixed
Status: newclosed

Fixed in r5539.

Note: See TracTickets for help on using tickets.