jQuery: The Write Less, Do More JavaScript Library

How to call another function on slider handle change?

View: New views
2 Messages — Rating Filter:   Alert me  

How to call another function on slider handle change?

by John-343 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am pretty new to jQuery.
I have got the slider working and I am trying to create a volume
control.
I have got the control so far that I have a function which takes a
value and changes the volume.
Now I need to find a way to call that function when the handle of the
slider changes, passing the value of the handle.

<script>
        $(function(){
                // Slider
                $('#slider').slider({
                         orientation: 'horizontal', step: 5, value: 50, animate: true
                });
        });
</script>

Tha'ts how far I have got. The function call is for example:
"changeVolume(number 1-100);"

Any help very much appreciated.

Thanks

--

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



Re: How to call another function on slider handle change?

by Richard D. Worth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Provide your callback function as the value of the slide option:

$('#slider').slider({
  orientation: 'horizontal',
  step: 5,
  value: 50,
  animate: true,
  slide: function(event, ui) {
    changeVolume(ui.value);
  }
});

In the function, the value of the handle can be found in ui.value.

- Richard

On Thu, Nov 5, 2009 at 3:12 PM, John <jdiste@...> wrote:
I am pretty new to jQuery.
I have got the slider working and I am trying to create a volume
control.
I have got the control so far that I have a function which takes a
value and changes the volume.
Now I need to find a way to call that function when the handle of the
slider changes, passing the value of the handle.

<script>
       $(function(){
               // Slider
               $('#slider').slider({
                        orientation: 'horizontal', step: 5, value: 50, animate: true
               });
       });
</script>

Tha'ts how far I have got. The function call is for example:
"changeVolume(number 1-100);"

Any help very much appreciated.

Thanks

--

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



--

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