Я ссылался на этот кодовый код для слайдера моего сайта
Сова Карусель 2 син c демо с циклом / автоигрой
Следующая кнопка в первой работает нормально
Но при другой кнопке вместо перехода к следующему или предыдущему элементу она переходит на 1 или 5
Есть ли какая-либо другая опция, которую я могу использовать для справки?
Я попытался изменить код, как в ссылке сказано:
function syncPosition(el) {
//if you set loop to false, you have to restore this next line
var current = el.item.index;
//if you disable loop you have to comment this block
//var count = el.item.count-1;
//var current = Math.round(el.item.index - (el.item.count/2) - .5);
//if(current < 0) {
// current = count;
//}
//if(current > count) {
//current = 0;
//}
//end block
sync2
.find(".owl-item")
.removeClass("current")
.eq(current)
.addClass("current");
var onscreen = sync2.find('.owl-item.active').length - 1;
var start = sync2.find('.owl-item.active').first().index();
var end = sync2.find('.owl-item.active').last().index();
if (current > end) {
sync2.data('owl.carousel').to(current, 100, true);
}
if (current < start) {
sync2.data('owl.carousel').to(current - onscreen, 100, true);
}
}
Newb ie здесь. Извините за вопрос.