问题
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