Button: Jump to top of the site
Hello together,
I´m searching for the funktion: Button: Jump to top of the site.
Background: If we have Threads with many postings, it's easier to click a button "go to top" then scroll all the way up again.
Can we implement this ourselves? Could I get instructions anywhere?
If we need to build a button with html/css: Ok - but after that: Where do we have to implement it?
Thanks & have a good weekend,
Best greetings, Alex
Hi Alex,
Lithium doesn't provide an out of the box component for that functionality.
You would basically need to create a custom component that shows a button, position and style that via CSS and finally attach via jQuery a click handler to do something like
$('html, body').animate({ scrollTop: 0 }, 'fast');
to scroll to the top via a smooth animation. See also https://stackoverflow.com/questions/4147112/how-to-jump-to-top-of-browser-page
Feel free to get inspired by inspecting some relevant elements via the web developer tools of your choice here on the Lithium Community.