Scroll to component 'on page enter' or 'on mounted'

We have a scrollable block “SB” that contains different components and we would like to be scrolled to a particular component when SB is mounted… but putting “Scroll to component” logic doesn’t seem to work in the “On Mounted” event handler. Nor does it seem to work in “On Page Enter”…

When we wire up “Scroll to component” to a button, the scroll to component works great ‘On Click’. But how to make the “scroll to” happen automatically when the SB block is mounted? Do we need to add some delay to the logic to wait for some (hopefully small) amount of time?

Just discovered the solution… we should make “scroll to component” be the last thing to run in the logic for “on mounted” (we have data coming in from API calls and other components being mounted in the SB container). We just need to be sure the SB container is fully mounted before calling “scroll to…”, so we put it last in the Codeless logic :slight_smile:

1 Like