Like the title, i need to change the next and prev text with the next and prev slide , not the current one that im seen.
on my current slide and in my next and previous button i like to see the text , text-slide , and text-slide
const swiper = new Swiper('.swiper', {
loop: true,
spaceBetween: 30,
pagination: {
el: ".swiper-pagination",
},
navigation: {
nextEl: '.next',
prevEl: '.prev',
},
on: {
init: function() {
updateCaptionText(this);
},
activeIndexChange: function() {
updateCaptionText(this);
}
}
});
let prev = document.querySelector('.prev');
let next = document.querySelector('.next');
function updateCaptionText(slider) {
let prev_text = document.querySelector('.prev-text');
let next_text = document.querySelector('.next-text');
console.log(slider.slides[slider.realIndex - 1]);
prev_text.innerHTML=slider.slides[slider.realIndex - 1].dataset.currentslide
next_text.innerHTML=slider.slides[slider.realIndex + 1].dataset.currentslide
}