Scroll Snap Workaround?

Hello there,
New to Wix Studio and looking for a coded (or actually better, not coded if possible) workaround to allow elements to trigger a Scroll Snap. The site I’m designing has 3 key features in one section which need to be snapped to in scroll in order to align sticky items with non-sticky ones.

Been using the method described in this video,

but this has since stopped working.

It’s a very basic coding once your elements are set up not to trigger two or more events at once and it did work fine using a simple “trigger” element to initiate ScrollTo to a “focus” element.
E.g.
export function trigger_viewportEnter(event) {
$w(‘#focus’).scrollTo();
}

Has anyone found a way to do this? In Resources, the Scroll Snap is a feature which is requested (please vote for it!) but has not been added yet.

Thank you!

1 Like

Hi !
I’m trying to do the same thing with no success..

The tutorial is about Editor X, but i’m using Wix Studio. I’m not sure how they’re different when it comes to code…

Here’s my try:

$w.onReady(function () {
    $w('#contactSection').onViewportEnter(() => {
            console.log("Viewport entered");
            $w('#contactSection').scrollTo();
    })
});

The log says the trigger is fired twice every time the section enters the screen. What could be the reason for that?

What am I missing here?