Navigation Buttons Does not work on me #8066
Unanswered
salahaldain-abduljalil
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Excuse me guys I need help I am using swiper by cdn with this way code but the matter navigation Buttons does not work I want the solution `let itemsPerPage = getItemsPerPage();
function getItemsPerPage() {
if (window.innerWidth >= 1200) {
return 3;
} else if (window.innerWidth >= 768) {
return 2;
} else {
return 1;
}
}
const swiper = new Swiper('.swiper-container', {
slidesPerView: getItemsPerPage(),
slidesPerGroup: getItemsPerPage(),
spaceBetween: 20,
loop: true,
speed: 5000,
effect: 'slide',
autoplay: {
delay: 1000,
disableOnInteraction: false,
},
navigation: {
nextEl: '#nextPromoted',
prevEl: '#prevPromoted',
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
simulateTouch: true,
followFinger: true,
touchRatio: 1,
breakpoints: {
768: {
slidesPerView: 2,
slidesPerGroup: 1,
},
1200: {
slidesPerView: 3,
slidesPerGroup: 1,
},
},
});
document.getElementById('nextPromoted').addEventListener('click', () => {
swiper.slideNext();
});
document.getElementById('prevPromoted').addEventListener('click', () => {
swiper.slidePrev();
});`
Beta Was this translation helpful? Give feedback.
All reactions