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

Cannot scroll without animation #1299

Open
2 tasks done
bonstio opened this issue Apr 12, 2024 · 0 comments
Open
2 tasks done

Cannot scroll without animation #1299

bonstio opened this issue Apr 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@bonstio
Copy link

bonstio commented Apr 12, 2024

Checks

Version

v4.1.3

Description

It's not possible to call scroll without invoking an animation.

Reproduction Link

No response

Steps to Reproduce

  1. Setup Splide

  2. Make a call (e.g. from the JavaScript Console) to

    splide.Components.Scroll.scroll(index, 0, true);

Since the duration param here is set to 0, there should NOT be a visible animation, yet there is.

The problem happens because of this line of code in Scroll.ts

duration = noDistance ? 0 : duration || max( abs( destination - from ) / BASE_VELOCITY, MIN_DURATION );

One fix is to explicitly check if duration has been defined:

   duration = noDistance ?
        0 : 
        (duration === undefined ? 
            max(abs(destination - from) / BASE_VELOCITY, MIN_DURATION) :
            duration);

Expected Behaviour

No scroll animation

@bonstio bonstio added the bug Something isn't working label Apr 12, 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

1 participant