Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Im trying to receive an index of the currently active slide, and thats work as expected, but in the console I can see that last page index same as one`s before last.

I tried this (inside init function)

let pageSlider = new Swiper('.page', {
    // initialise make my own classes as standart sliders classes 
    wrapperClass: "page_wrapper",
    slideClass: "page_screen",


    // events
    on: {
        init: function () {
            menuSlider();
            setScrollType();
            wrapper.classList.add('_loaded');
            let text = document.getElementById('opacity_change').getElementsByClassName('screen_title');

            for (let index = 0; index < text.length; index++) {
                text[index].classList.add('_loaded');
            }

        },

        slideChange: function () {
            menuSliderRemove();
            menuLinks[pageSlider.realIndex].classList.add('_active');
            let active = this.activeIndex;                               // LOOK HERE                           
            console.log(active);                                         // LOOK HERE
        },

        resize: function () {
            setScrollType();
        }
    }

});

and that (outside init function)

pageSlider.on('transitionEnd', function () {
    console.log('*** pageSlider.realIndex', pageSlider.realIndex);
});

and got the same result

If you look on the screenshot, I`ve set up pagination bullets, so we can see that I have 5 slides, but switching between fourth and fifth return same index - 3. Somebody know possible reasons?

Thanks in advance!

console output


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
328 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...