Remove "Scroll to...." scroll animation

Working on a mobile tab bar and want it resemble a native app as much as possible. When changing tabs, I need the page to scroll to 0 but without animation. The built in one animates scroll, but I need it to be instant.

Any tips?

That might do the trick itself…not sure what you are really looking for in terms of no animation

Here is a link that you may need to investigate further if my above screen shot doesn’t do exactly what you want

1 Like

Thanks for this. No animation = instant. Since it’s a single-page app with tabs, scrolling down the page affects all tabs. When switching tabs, I’d love it to appear already at the top of that tab.

I’m trying to use your expression but it wont allow me to use the page itself as a parameter (which is the thing that’s scrolling). Any ideas?

Been looking for a way to do this as well. Parts of the app is single page, where I need it to “load” instantly. But the scroll animation makes it a bit confusing from a user perspective, where what looks like a new page to them starts scrolling.

So you would need a “jump” to position instead of “scroll” to position. But I’m not sure that’s even possible?

I guess it is,

1 Like

I don’t know why it wouldn’t be working for the page. The part that says ‘window.scrollTo’ the window is the page as far as I know.

In my app I have the page stop scrolling when I open my sidebar navigation. This causes the page to scroll up no matter where on the page the user is currently at when the open the side bar navigation.

When the user would close the side bar navigation, without this javascript the page would remain at the top. When I added this javascript the page would scroll down to the position used in the dynamic data.

What you might want to do is set the expression to

window.scrollTo(0,0)

1 Like

Are you using the router plugin or the browser plugin to change the URL?

BAM! That did it my Bubble friend! As always, thanks for being helpful!!

1 Like

Just reading what you wrote makes me feel like you are not setting up the single page portions with groups that are aligned vertically to each other with collapse height when hidden selected so that as the user navigates on the single page, the groups ‘hide’ and collapse bringing the group that should be displayed to the top of the page immediately.

One way to enable the user to still use the browser back and forward buttons in that set up to navigate beyond just using on page tabs or buttons, is to use the router plugin or the browser plugin…they can change the URL and allow the browser buttons to be used to navigate between the changed URLs as changed from the page.

No worries. Just mark the reply as the solution so other users will know in the future the thread as a solution to help when they may be searching for the same issue. It shows next to the title in searches if it is solved or not, making the tedious task of sifting and sorting through threads a bit easier to find solutions.

1 Like

Rather than boring you with an explanation of the page, I wasn’t able to set it up with the stacked groups in a good way in one place, so I ended up with scrolling to position. But your javascript solved the animated scroll issue. so all good, and thank you :slight_smile: At some point I might re-design the page in a way where stacked groups works, since that would make it more consistent throughout the app, and also better in general.

I didn’t know about the router plugin or browser plugin, that sounds great tho, as I was looking for a way to enable browser back functionality. Will have a look at that, thank you for pointing that out!

I think the router plugin is inherit in that ability. The browser plugin gives two options to change the URL, I think it is ‘replace’ and the other is ‘modify’…I forget which one gives the ability to use browser navigation, while the other doesn’t.

The downfall of browser plugin is that the URL paths as a list does not register these changes and neither does the router plugin so you can’t use URL paths as a list item numbers for setting conditionals.

However, the router plugin stores the paths and parameters itself, so you can use its values for conditionals.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.