The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Hi everyone,

I have a button at the bottom of a ScrollContainer. I'd like that ScrollContainer's content-list to "jump back to the top position" when hitting that button. Any ideas how that could be done?

Godot version 3.3
in Engine by (525 points)

Thanks, for posting this question you saved my time searching for this problem.

1 Answer

+1 vote
Best answer

Just did some quick experimentation and this seems to work.

func _on_Button_pressed():
    var sb = $ScrollContainer.get_v_scrollbar()
    sb.ratio = 0

So, wire your Button's press event to something like the above. That just gets the underlying scrollbar component and sets its ratio property to 0 (where 0 = the top and 1 = the bottom).

by (22,674 points)
selected by

Works like a charm, thank you very much!

I had the same question and this works perfectly. Thank you!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.