swup / scroll-plugin

A swup plugin for smooth scrolling 🏄‍♂️

Home Page:https://swup.js.org/plugins/scroll-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

animateScroll doesn't seem to work

kosruben opened this issue · comments

Hi Georgy,

First of all. Great stuff on this plugin, it is really easy to use and works awesome!

I am trying to set animateScroll to false to disable the scrolling animation when navigating to another page.

However, it doesn't seem to work for me, no matter the value I use. The pages are always scrolling when I navigate to one and another as soon as I have a CTA that is positioned lower on a page.

My configuration is quite simple:

const swupOptions = {
    containers: ['#container'],
    plugins: [
        new SwupDebugPlugin(),
        new SwupBodyClassPlugin(),
        new SwupPreloadPlugin(),
        new SwupScrollPlugin({
            doScrollingRightAway: true,
            animateScroll: false,
            scrollFriction: 0.3,
            scrollAcceleration: 0.04
        }),
        new SwupJsPlugin(swupTransitions)
    ]
};

const swup = new Swup(swupOptions);

Thank you again for the plugin and any help!

I have the same problem, I can't disable the animateScroll

Hi 👋 and thanks!
Unfortunately, I can't reproduce (works as expected for me with your setup). Could you provide and demo where we could check?

@gmrchk Hi Georgy, thank you for coming back to me.

I tried to isolate the issue by creating a new and very simple project and you are right, it works as expected in there.

This means I am not able to reproduce the issue outside the project I am working on, it probably has to do with some of the dependencies I am using or just a bug in my code. I will spend more time to try to find it. In case it is related to your work I will leave the solution on this ticket.

It kind of sounds like the old version of swup is running instead, which also includes scroll plugin within. Just an idea...

Ok, found it. I feel so stupid. I left the property scroll-behavior: smooth; in my CSS a while back which was set on the HTML & Body tags. Sorry for wasting your time and thanks again for such an awesome plugin!

Ok, found it. I feel so stupid. I left the property scroll-behavior: smooth; in my CSS a while back which was set on the HTML & Body tags. Sorry for wasting your time and thanks again for such an awesome plugin!

I know it's years later, but I had the exact same experience. Turning off Swup's scrolling and navigating to another page, but scrolling still stuck at the bottom. I had scroll-behavior: smooth on, as well. Turned that off, things worked just fine.