Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Button Skips Multiple Slides on First Click in SplideJS #1311

Closed
2 tasks done
squidiw opened this issue May 29, 2024 · 10 comments
Closed
2 tasks done

Next Button Skips Multiple Slides on First Click in SplideJS #1311

squidiw opened this issue May 29, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@squidiw
Copy link

squidiw commented May 29, 2024

Checks

Version

v4.1.4

Description

My parameters are
{ type:"loop" , padding:{ right: '10%', left: '10%'},}

Link to see whats happening -- https://github.com/Splidejs/splide/assets/39523709/6d18f096-721f-4650-8498-70487bb055a0

Reproduction Link

No response

Steps to Reproduce

Screen.Recording.2024-05-29.at.11.51.19.AM.mov

Expected Behaviour

When next button is clicked it should move only one slide.

@squidiw squidiw added the bug Something isn't working label May 29, 2024
@eiiot
Copy link

eiiot commented Jun 8, 2024

Running into this exact same issue, did you ever figure out a fix?

@squidiw
Copy link
Author

squidiw commented Jun 10, 2024

Nope not yet

@Webberjo
Copy link

Try setting perMove to 1.

@squidiw
Copy link
Author

squidiw commented Jul 24, 2024

Try setting perMove to 1.

Yes sir, I already do have that in my settings.

This is how it looks.
1366:{ type:'loop', start:0, //I even added start 1 & 0 to see if it helped but nothing. padding:{ right: '10%', left: '10%'}, perPage:{{ section.settings.number_of_slides }}, gap:'24px', perMove:1, }

@Webberjo
Copy link

I'm unable to reproduce this using those options in Splide 4.1.4.
https://jsfiddle.net/Webberjo/d5hx70m1/4/

Do you have options being set on the splide element in the HTML that may be interfering with the JS options?

@squidiw
Copy link
Author

squidiw commented Jul 26, 2024

I'm unable to reproduce this using those options in Splide 4.1.4. https://jsfiddle.net/Webberjo/d5hx70m1/4/

Do you have options being set on the splide element in the HTML that may be interfering with the JS options?

No, no data attributes being used at the moment, is there a way to reach you, so I can send you a link to the website with this issue and maybe looking at it you can see something that I'm missing?

I checked your portfolio and I saw your hotmail, you still using it?

@Webberjo
Copy link

Why not include a link to your page with the issue here?

@squidiw
Copy link
Author

squidiw commented Jul 26, 2024

It’s a shopify store and some clients are a bit weird about posting their store links but yeah I guess I can post it here in the meantime - https://www.ettika.com/

Please scroll down almost to the footer and you'd see it. And also this issue with the slider is only on desktop.

Screenshot 2024-07-26 at 5 10 17 PM

@Webberjo
Copy link

If you're programmatically adding slides after the slider has been mounted, try doing slider.refresh() afterwards.

@squidiw
Copy link
Author

squidiw commented Jul 27, 2024

Thnak you @Webberjo adding refresh() and manually adding event listeners to the arrow buttons fixed it.

@eiiot , this is exact what I did.

document.addEventListener('DOMContentLoaded', function() {
        let splide = new Splide( '.splide.wearconfidence', {
        // params here
        }
    });
    splide.mount();
    splide.refresh();
    const prevButton = document.querySelector('.splide__arrow--prev');
    const nextButton = document.querySelector('.splide__arrow--next');

    if (prevButton) {
        prevButton.addEventListener('click', function() {
            splide.go('-1');
        });
    }

    if (nextButton) {
        nextButton.addEventListener('click', function() {
            splide.go('+1');
        });
    }

@squidiw squidiw closed this as completed Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants