Global

Back to top

A floating button that takes the visitor back to the top of a long page.

Example

Floating button

On real pages the button is hidden until the visitor scrolls down 400 px. site.js does this and scrolls smoothly (instantly for users who prefer reduced motion). It is already used on this page: scroll down to see it.

With scroll progress

A ring around the button fills as the visitor scrolls down the page, so it also shows how far through a long listing page they are. Scroll the box below to try it.

Sunlit three-bedroom apartment on the fourth floor, with a south-facing balcony and views over the park. The open-plan kitchen has stone worktops and a breakfast bar.

The building has a lift, secure bike storage and a residents' garden. Two minutes on foot to the tram stop, ten to the old town and the weekend market.

Both bathrooms were renovated last year. Underfloor heating throughout, oak floors in the living areas and fitted wardrobes in every bedroom.

Service charge covers cleaning, the lift contract and building insurance. Pets are welcome, and a parking space in the underground garage can be rented separately.

Viewings are available every day this week. Book a slot with the listing agent, or ask for a video tour if you are not in the city.

Nearby: two primary schools, a supermarket, a pharmacy and a small gym. The coast road is a twenty minute drive.

Energy rating B. Freehold share. No onward chain, so the sale can complete quickly.

Ring states

Top of the page
40% scrolled
Bottom of the page

The ring starts at the top and fills clockwise. It works with the normal page scroll. To make a button follow a scrollable box instead of the page (a dashboard panel, for example), add data-scroll-target="#box-id".

Classes

ClassPurpose
.back-to-topFixed bottom-right button. .is-visible is added by site.js.
.back-to-top--progressVariation with a progress ring around the button. Add the ring SVG inside it.
.back-to-top-ring, -track, -fillThe ring SVG, its grey track and the coloured arc that fills as the visitor scrolls.
--progressA number from 0 to 100, set on the button by site.js. You can also set it yourself for a static preview.
data-scroll-targetOptional. A selector for a scrollable box the button should follow instead of the page.