Option 1: Manually update the value

$("#down").click(function() {
  var s = $("#slider"), val = s.slider("value"), step = s.slider("option",
"step");
  s.slider("value", val - step);
});
$("#up").click(function() {
  var s = $("#slider"), val = s.slider("value"), step = s.slider("option",
"step");
  s.slider("value", val + step);
});

Option 2: extend the slider plugin to have two new methods: 'up', and 'down'

$.extend($.ui.slider.prototype, {
  up: function() {
    this.value(this.value() + this.options.step);
  },
  down: function() {
    this.value(this.value() - this.options.step);
  }
});

$("#down").click(function() {
  $("#slider").slider("down");
});
$("#up").click(function() {
  $("#slider").slider("up");
});

- Richard

On Thu, Mar 12, 2009 at 3:29 AM, Sjur <[email protected]> wrote:

>
> Hello,
>
> I just started out using jQuery UI a few days ago, but have been using
> jQuery for quite some time. The reason I tried out the UI component is
> that I needed a customizable slider.
>
> The slider functions just fine for me, but I'd like to be able to add
> next/previous buttons so that the user easily can navigate up and down
> on the slider. I know the user can use the arrow keys on the keyboard,
> but that is a fairly hidden feature that most users woun't know about.
>
> What I'm really asking about is if there is some kind of way to
> trigger a "move to next value" function on the slider widget. From
> what i have read in the documentation there isn't, but as i don't have
> the source code (in a readable way) I'm not able to check if there is.
>
> Cheers, Sjur
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to