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

`swup.scrollTo()` method needs review

hirasso opened this issue · comments

While cleaning up I noticed that the docs about swup.scrollTo() are outdated:

https://swup.js.org/api/methods#scrollto

Which lead me to think closer about it. The current implementation in Scroll Plugin allows setting the animated argument, which doesn't really make sense here, since animating the scroll position would be the whole point of using the method in the first place.

We should probably rather discuss if we want to allow targeting a specific element to be scrolled, something like this (Pseudo Code):

swup.scrollTo(2000, {target: window|HtmlElement})

Making this possible would need enhancements of gmrchk/scrl, to add the possibility to target and handle specific elements other than window.

This is somewhat related to #26 .

@daun any opinion on this?

Just corrected the docs for now, see PR above.

I agree about extending the method to allow targeting other elements but we'd need to wait for upstream changes to the underlying scroll library, no?

Already created a PR for that: gmrchk/scrl#1