jQuery slider go back to front slider when reached end of slider?
Process: I load an HTML on a div with Ajax when it reaches the end of slider scroll.
I want the slider to go back to front (starting point) when the process above executes.
jQuery slider go back to front slider when reached end of slider?
Process: I load an HTML on a div with Ajax when it reaches the end of slider scroll.
I want the slider to go back to front (starting point) when the process above executes.
You can use jQuery's scrollLeft and scrollTop functions to set the position of the scrollbar in your AJAX callback.
In your slider initialization code, there's an available slide
event:
$('.selector').slider({
//Current stuff...
slide: function(event, ui) {
if($(this).slider('option','max') === ui.value) {
$(this).slider('option','value',$(this).slider('option','min'));
return false;
}
}
});
When reaching max value, reset to min value, return false;
cancels the slide so the reset can take effect.