和标题一样,我需要修改下一份和前文,并改写下台和前方滑坡,而不是眼看到的当前案文。
在我目前的幻灯片和我下台和前台的 but子中,我想看到案文、文字滑坡和文字滑坡。
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
}
这是正在工作的超文本标记。
<div class="swiper w-[50%]">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<div class="swiper-slide" data-currentslide="1">
<div class="flex flex-1 items-start justify-center gap-5 min-h-full">
<img src="//placehold.it/770x460" alt="" class="rounded-xl" >
</div>
</div>
<div class="swiper-slide" data-currentslide="2">
<div class="flex flex-1 items-start justify-center min-h-full">
<img src="//placehold.it/770x460" alt="" class="rounded-xl" >
</div>
</div>
<div class="swiper-slide" data-currentslide="3">
<div class="flex flex-1 items-start justify-center min-h-full">
<img src="//placehold.it/770x460" alt="" class="rounded-xl" >
</div>
</div>
<div class="swiper-slide" data-currentslide="4">
<div class="flex flex-1 items-start justify-center min-h-full">
<img src="//placehold.it/770x460" alt="" class="rounded-xl" >
</div>
</div>
</div>
<div class="swiper-pagination left-[100px] bottom-40"></div>
</div>
这是下游和Prevutton
<div class="">
<div id="prev" data-prev="" class="bg-red-600 px-5 py-4 inline rounded-full prev"><
</div>
<span class="prev-text"> Test </span>
<span class="next-text"> Test </span>
<div id="next" data-next="" class="bg-red-600 px-5 py-4 inline rounded-full next"> ></div>
</div>
</div>