infinity-forge
Version:
38 lines • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = slideNext;
/* eslint no-unused-vars: "off" */
function slideNext(speed, runCallbacks, internal) {
if (runCallbacks === void 0) { runCallbacks = true; }
var swiper = this;
var enabled = swiper.enabled, params = swiper.params, animating = swiper.animating;
if (!enabled || swiper.destroyed)
return swiper;
if (typeof speed === 'undefined') {
speed = swiper.params.speed;
}
var perGroup = params.slidesPerGroup;
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
}
var increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
var isVirtual = swiper.virtual && params.virtual.enabled;
if (params.loop) {
if (animating && !isVirtual && params.loopPreventsSliding)
return false;
swiper.loopFix({ direction: 'next' });
// eslint-disable-next-line
swiper._clientLeft = swiper.wrapperEl.clientLeft;
if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {
requestAnimationFrame(function () {
swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
});
return true;
}
}
if (params.rewind && swiper.isEnd) {
return swiper.slideTo(0, speed, runCallbacks, internal);
}
return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
}
//# sourceMappingURL=slideNext.js.map