JQuery UI Slider - 'value' not setting starting position of handle

Go To StackoverFlow.com

0

I would expect the following code to start my slider at '30' in it's range of 0-250, but yet it is not.

$(function() {
  $( "#slider" ).slider({
  value: 30,
  min: 0, 
  max: 250,
  step: 1, 
  slide: function(event, ui){
    $("#edit-varprice").val(ui.value + ".00");
  }  
  });
});

Image : http://gallery.twardnw.com/var/albums/Misc/Screen%20shot%202012-04-03%20at%203.06.59%20PM.png?m=1333490924

2012-04-03 22:09
by twardnw


1

Its working fine for me. See jsFiddle Demo.

Perhaps you are missing something else or doing something in other parts of your code, can you post full code?

2012-04-03 22:37
by neo108
That's my full script - twardnw 2012-04-03 23:12
What about edit-varprice? Where is that declared - neo108 2012-04-03 23:13
That's built by a module on my site, I'm just latching onto it (Drupal site, uc_varprice module). After looking at jsFiddle, it might be a version problem. This site is using jquery 1.2.6 and jqueryui 1. - twardnw 2012-04-03 23:23
Yep, version problem, updated jqueryui to 1.7 and it works now - twardnw 2012-04-03 23:31
Good. Glad it works. Don't hesitate to accept the answer if you think it has helped you solve the problem - neo108 2012-04-03 23:36


0

try removing the value from the options u chose, and adding it later using:

$( "#slider" ).slider( "option", "value", 40 );
2012-04-03 22:18
by Rorchackh


0

Could you lower your max to 50 and see if the slider handle is offset, if so then its working just fine. In the image it looks like its slightly offset. 30/250 is only 12% and may be deceiving.

2012-04-03 22:18
by cha55son
Ads