How to move to the next slide without animation for BxSlider?

别说谁变了你拦得住时间么 提交于 2019-12-11 06:45:53

问题


I am using a jQuery plugin bxSlider.

There are two custom buttons, prev and next to toggle the sliding.
However, there is a specific situation where I need to move to a slide without animation, I want it to be instant.

Is there a way to achieve this?


回答1:


From the available options,

Set the option speed to 0, you will not get any animation.

$('.bxslider').bxSlider({
  mode: 'fade',
  speed: 0,
  captions: true
});

DEMO




回答2:


jQuery:

$('#slider').bxSlider({...});

$('.pager-item').on('click', function(){
  // bx-slider instant slide hack

  $('#slider').addClass('instant-slide');
  setTimeout(function(){
    $('#slider').removeClass('instant-slide');
  }, 100);

});

SCSS:

#slider {
 &.instant-slide {
   -webkit-transition: 0.001s ease !important;
   transition: 0.001s ease !important;
 }
}

this works for me, can be adapted to use with goToSlide()

{ useCSS: true }

required.



来源:https://stackoverflow.com/questions/14179654/how-to-move-to-the-next-slide-without-animation-for-bxslider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!