Streaming live at 10am (PST)

How to use the scroll() javascript method in a webflow animation

Hi everyone!

Basically what I’m looking for is a way to scroll a div horizontally(will have position: sticky; top: 0;) based on when a section is scrolled to the top of the screen(ex. scroll into view webflow animation trigger. The div block will have links that go to there respective section on the page, but I’d like the links to scroll horizontally so that the “active” link is the very left most link shown at the top of the screen.
The only way I’m aware to scroll a div without manually doing it is via the javascript scroll() method. Is there a way to trigger custom code off of a webflow animation trigger, or maybe another way to scroll the div without using scroll() at all and instead using something entirely in webflow.

Thanks!

Hey @johnplataos
If I understood your requirements correctly you don’t need custom code for that sort of thing. You can do it only through wf interactions.
https://preview.webflow.com/preview/anna-header-animation?utm_medium=preview_link&utm_source=designer&utm_content=anna-header-animation&preview=7faf7300293f21132dd6135713650e80&pageId=6027f897f1ed8b5d069b669d&mode=preview
Here is a preview link of how it’s done, let me know if you have any questions, cheers!

1 Like