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

Scroll options not applied correctly

daun opened this issue · comments

Description of the issue

With the switch to scroll:top and scroll:anchor, we've lost the ability to distinguish top/anchor scrolling on the same page vs. top/anchor scrolling after a page load. Inside the scroll:* handler, there is no way of knowing if the scrolling is part of a visit or a same-page hash-scroll. This means that the animateScroll option is applied incorrectly.

How to reproduce the issue

Set animateScroll to non-equal values:

animateScroll: {
  betweenPages: false,
  samePageWithHash: true,
  samePage: true
}

I think I'm just hallucinating things now — everything's working as expected :)