I need to remove the default navigation (nextEl, prevEl) and make the button with the text "Next Slide Button" scroll to the next slide
<swiper class="news-slider" :sliderd-per-view="1" :modules="[Navigation, Pagination, A11y, Lazy]" navigation="navigation" :navigation="{ nextEl: '.nextArrow'}" :pagination="{ clickable: true, dynamicBullets: true, dynamicMainBullets: 5 }" preload-images="false" lazy="lazy"> <swiperSlide class="swiper-slide" v-for="n in 10" :key="n"> <div class="news-container"> <div class="news"><img class="news__image swiper-lazy" src="@/assets/img/lookism-transformed-transformed.png" alt=""/> <div class="swiper-lazy-preloader"></div> <div class="news__info"> <div class="news__title">title</div> <div class="news__description">description</div> <div class="news__buttons"> <button class="normal-button news-button">more</button> <button class="next-button"><span class="next-button__text">NEXT SLIDE BUTTON</span><img class="next-button__icon" src="@/assets/img/arrow-right.svg" alt=""/></button> </div> </div> </div> </div> </swiperSlide> </swiper> <script> export default { components: { Swiper, SwiperSlide, }, setup() { const onSwiper = (swiper) => { console.log(swiper); }; const onSlideChange = () => { console.log('slide change'); }; return { onSwiper, onSlideChange, modules: [Navigation, Pagination, Scrollbar, A11y], }; }, }; </script>
How can I do this? I will be very grateful for your help
This should do the trick, all you need to do is import
useSwiper
and assign it to a const variable and then use it inside the div element asswiper.slideNext()
If you don't want to use swiper on your own elements, remove the
navigation
module.This is a clearer documentation source
https://swiperjs.com/vue#use-swiper