i use the jquery ui slider and all is fine except that the function
i defined in开发者_如何学Python the change parameter fired
only when i release the mouse over the handles. Is there a way to call the function when the mouse is released outside the slider
?
thanks for helping.
$("#slider").slider({
start: function(event, ui) {
// do something on mousedown on slider
},
stop: function(event, ui) {
// do something on mouseup anywhere
}
});
I think you have used like this.... Nature of change event is that when you mouse up than it will show changes in slider event...
$( ".selector" ).slider({
**change**: function(event, ui) { ... }
});
Now you can use this type slide event......so every time you will move slider than It will show effect and calling this function.
$( ".selector" ).slider({
**slide**: function(event, ui) { ... }
});
Dhaval mistry...(UI developer
)
You can use change. It will works as a callback. Based on http://api.jqueryui.com/slider/ You can:
$('.selector').slider(function() {
change: function( event, ui ) {}
});
There would seem to be something wrong here, the change event is based on the slider position moving and therefore if you can see the pin being dragged whilst the mouse is down then the event should still fire irrespective of where your mouse ends up.
Is this the standard jquery slider you are using? If so, try the same test on the official demo page:
jQuery UI demo page
You will see that no matter where your mouse is the change event still fires so long as you continue to hold the mouse button down after initially clicking the pin.
I also faced same issue. For me, its happening when slider is part of child div and rest of screen is covered by a parent div. Consider following scenario:
Press mouse button when mouse pointer is on the slider bar,
drag it for a while and bring mouse pointer out of child div.
Now the mouse pointer is on parent div.
Release mouse button.
Observe slider bar is still highlighted.
Bring mouse pointer back to child div without pressing button.
Observe the movement in slider bar.
Yes I'm using default jquery slider. Brian please look at
http://api.jqueryui.com/slider/#entry-examples
At the bottom of page with the example slider you'll see the same issue I was talking about.
This problem is related to http://bugs.jqueryui.com/ticket/8912
I tried the following hack and it worked:
use the jQuery hover function to attach a mouse out handler on the element that contains the slider. If the mouseout occurs during sliding, trigger a mouseup to the slider handle element.
精彩评论