jQuery: The Write Less, Do More JavaScript Library

Ticket #2677 (closed bug: fixed)

Opened 1 month ago

Last modified 4 days ago

[slider] moveTo relative increment

Reported by: hubbardr1 Assigned to: joern
Type: bug Priority: major
Milestone: 1.2.4 Component: ui
Version: Keywords: slider moveTo
Cc: Needs: Review

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

Change History

Changed 1 month ago by paul

  • owner changed from paul to joern

Changed 4 days ago by joern

  • summary changed from Slider moveTo relative increment to [slider] moveTo relative increment

Changed 4 days ago by paul

  • status changed from new to closed
  • resolution set to fixed

Fixed in r5539.

Note: See TracTickets for help on using tickets.