Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

291
Views
SwiperJS. Pagination not working after swiping an item

I'm using SwiperJS for a Gallery Carousel, I'm using the vanilla method in AlpineJS, pagination is working on clicks (on dots or arrows) but if I swipe the image, the pagination is still in the same dot, I tried with this solution but pagination still not working on swiping

This is my Laravel mix app.js file

import Swiper, { Navigation, Pagination } from 'swiper';
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';
window.Swiper = Swiper;
window.SwiperNavigation = Navigation;
window.SwiperPagination = Pagination;

and this is my alpineJS code

          <div class="py-2"
              x-data="{swiper: null}"
              x-init="swiper = new Swiper('.swiper',
                   {
                      modules: [SwiperNavigation, SwiperPagination],
                      loop: true,
                      slidesPerView: 'auto',
                      centeredSlides: true,
                      spaceBetween: 30,
                      hashNavigation: {
                      watchState: true,
                   },

                      pagination: {
                        el: '.swiper-pagination',
                        clickable: true,
                      },

                      navigation: {
                        nextEl: '.swiper-button-next',
                        prevEl: '.swiper-button-prev',
                      },
                        })">
                   <div class="swiper w-full h-72">
                     <div class="swiper-wrapper">
                        @foreach($detail->getMedia('post-medias') as $index => $media)
                           <div class="swiper-slide flex justify-center" data-hash="slide{{$index+1}}">
                                  <img class="h-64"
                                             src="{{$media->getUrl()}}">
                           </div>
                        @endforeach
                     </div>
                     <div class="swiper-pagination"></div>
                     <div class="swiper-button-prev"></div>
                     <div class="swiper-button-next"></div>
               </div>
           </div>

In the web browser console, I didn't receive any error message

How can I solve it?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!