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 activeIndex issue

See original GitHub issue

Swiper activeIndex is not working properly on last-slide, On every callback function it returns second last slide activeIndex number.

I am using swiper 3.3.1 latest version with following code.

        $('.sw-' + index).swiper({
        nextButton: $(this).find('.swiper-button-next'),
        prevButton: $(this).find('.swiper-button-prev'),
        pagination: $(this).find('.swiper-pagination'),
        slidesPerView: 'auto',
        paginationClickable: true,
        spaceBetween: 10,

        onSlideChangeStart: function (swiper) {

            console.log('slidechangeStart: '+swiper.activeIndex);
        },
        onSlideChangeEnd: function (swiper) {

            console.log('slidechangeEnd: ' + swiper.activeIndex);
        },
        onTransitionEnd: function (swiper) {

            console.log('onTransitionEnd: ' + swiper.activeIndex);
        },
        onInit: function (swiper) {
            swiper.update(true);
        }
        });

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
ivanempirecommented, Jan 29, 2018

So, How do I know the last slide appear ?

5reactions
1mike12commented, Jan 29, 2018

So, How do I know the last slide appear ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

realIndex and activeIndex in useSwiper is not change ... - GitHub
It is surprising that useSwiper does not result in a re-render when the swiper state changes. This makes the hook pretty much useless,...
Read more >
How to use " swiper.activeIndex " with if condition?
I am using Swiper.js in my project. I want to know the current active slider. How can I use swiper.activeIndex with an if...
Read more >
Swiper API
Swiper is the most modern free mobile touch slider with hardware accelerated transitions and amazing native behavior.
Read more >
swiper current index - You.com | The Search Engine You Control
The number of slides, and thus sometimes the activeIndex , is "wrong" by design when loops are involved: https://github.com/nolimits4web/Swiper/issues/1205.
Read more >
react-native-web-swiper - npm
The slide automatically gets props.activeIndex and props.index . import React from 'react'; import ...
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