Skip to content

New `reverse` option

Compare
Choose a tag to compare
@Twikito Twikito released this 13 Feb 14:33
· 21 commits to master since this release
fe0d15c

The default behaviour of this library is adding a class when the element is outside of the viewport, but sometimes, you may need the opposite behaviour, i.e. adding a class when the element is inside the viewport.

So here is a new attribute data-scroll-reverse: Instead of adding the class when the element is outside of the viewport, reverse this behaviour and add the class when the element is inside the viewport, is-inside class name as default if data-scroll is empty.

In this case, you will probably need to add the class to your element as default in your code to avoid JavaScript dependency.

Thanks @CFT-Chris for the pull request 👍