开发者

jQuery slider go back to front slider when reached end of slider?

开发者 https://www.devze.com 2022-12-21 19:53 出处:网络
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 slid开发者_运维百科er scroll.

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 slid开发者_运维百科er scroll.

I want the slider to go back to front (starting point) when the process above executes.


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.


You can use jQuery's scrollLeft and scrollTop functions to set the position of the scrollbar in your AJAX callback.

0

精彩评论

暂无评论...
验证码 换一张
取 消