question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swiper pagination selects wrong slide on click

See original GitHub issue

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • Swiper Version: EXACT RELEASE VERSION OR COMMIT HASH, HERE.

  • Platform/Target and Browser Versions: PLATFORM CLIENT YOU ARE TARGETING SUCH AS macOS, Windows, CORDOVA, IOS, ANDROID, CHROME, ETC.

  • Live Link or JSFiddle/Codepen or website with isssue: PREFERABLY (IF YOU WANT YOUR ISSUE TO BE RESOLVED ASAP).

What you did

I am using vue-awesome-swiper in my vue/nuxt project. I added pagination like this:

pagination: {
  el: '.swiper__paging',
  type: 'bullets',
  bulletClass: 'swiper__paging-number',
  bulletActiveClass: 'swiper__paging-number--active',
  clickable: true,
  renderBullet: function (index, className) {
    return '<h5 class="number-'+ (index + 1) + ' ' + className + '"' + 'index="' + (index + 1) +'">' + (index + 1) + '</h5>';
  }
},

All settings:

homepageSwiperOptions: {
    slidesPerView: 1,
    resizeReInit: true,
    direction: 'vertical',
    spaceBetween: 100,
    wrapperClass: 'swiper__wrapper',
    fadeEffect: {
    crossFade: true
  },
  grabCursor: true,
  navigation: {
    nextEl: '.icon--next',
    prevEl: '.icon--prev'
  },
  pagination: {
    el: '.swiper__paging',
    type: 'bullets',
    bulletClass: 'swiper__paging-number',
    bulletActiveClass: 'swiper__paging-number--active',
    clickable: true,
    renderBullet: function (index, className) {
    return '<h5 class="number-'+ (index + 1) + ' ' + className + '"' +  'index="' + (index + 1) +'">' + (index + 1) + '</h5>';
  },
  breakpoints: {
    960: {
      direction: 'horizontal'
    }
  }
}

Expected Behavior

Pagination by clicking on a number

Actual Behavior

Swiper pagination selects wrong slide on click Very buggy: swiper-bug

P.S. Remember, an issue is not the place to ask questions. You can use Stack Overflow for that.

Before you open an issue, please check if a similar issue already exists or has been closed before.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Rituralcommented, Sep 18, 2019

Adding touchEventsTarget: 'wrapper' as a swiper option seemed to fix it for me 😃

Mentioned on a Swiper issue here

1reaction
avilesasturiascommented, Apr 9, 2019

Got the same issue with this bullets/dots jumping to the wrong slide when using the normal js version of swiper. This is from Swiper’s demo page: https://idangero.us/swiper/demos/110-slides-per-view.html Just click randomly around the bullets and at some point it will start to jump to wrong slide. Any help or fix on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

swiper.update() slider wrong amount of pagination dots
I tried swiper.updateSlides() but that made all slides appear? I'm lost here - howcome the dots don't update?
Read more >
Swiper API
Clicking "prev" navigation button (or calling .slidePrev() ) when on first slide will slide forward to the last slide. Should not be used...
Read more >
Swiper Clickable Pagination | JavaScript - CodePen
URL Extension Required. When linking another Pen as a resource, make sure you use a URL Extension of the type of code you...
Read more >
swiper get active slide | The AI Search Engine You Control
When the slider reach the last slide, either by dragging or clicking on the pagination bullets, the last slide doesn't get the "swiper-slide-active"...
Read more >
Swiper
Index number of initial slide.). centered-slides, boolean, false, If true, then active slide will be centered, not always on the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found