views:

2141

answers:

4

I have a JQuery silder that I'm using to set the score on a web application. I orignally had it so that the user clicked a submit button, but the client now wants it to update AJAX style.

This would work find, but the slide function gets call on every movement, so my AJAX script will send a score before the slider has finished being moved.

Is there a function on the JQuery slider that gets called on release of the slider? Is there a straight forward way for me to check to see when the slider has been released?

Thanks,.

+2  A: 

After a quick perusal of the source code, I would say to try using 'stop' or 'change' instead of 'slide.' It seems that the 'stop' event happens on mouseup, and the 'change' event happens on mouseup but only if the value changed. I didn't see any documentation on this, of course, I didn't look very hard.

FryGuy
Thanks, I couldn't find that in the source, but I guess I was looking at the wrong documentation. Exactly what I was looking for.
Ryan Smith
+1  A: 
Stobor
+1  A: 

When initializing the slider, use this:

var slider = $('.slider').slider({ 
    steps: 10,
    handle: $('.knob'),
    animate:'true',
    min:1,
    max:10,
    startValue: 1,
    change: function(e,ui){
        //Do something with ui.value
    } 
});
Salty
A: 

I would like to know, "How can I call slider stop function outside the slider code." Suppose, I want to call that function when a click event fired on checkbox.

Thanks Apul Gupta http://in.linkedin.com/in/apulgupta

Apul