Elevator
A back-to-top button that takes its time, with music.
A back-to-top link is a solved problem, and a dull one. Elevator.js solves it differently: the page rides back up at a leisurely pace while elevator music plays, and dings when it arrives.
elevator wires that into Quarto as a shortcode. One line gives you the button, the script, and the bundled arrival sound.
Installation
quarto add mcanouil/quarto-elevator@1.5.1This will install the extension under the _extensions subdirectory. If you are using version control, you will want to check in this directory.
Or install it from your editor with Quarto Wizard:
Quick start
{{< elevator >}}That is the whole thing: a button labelled “Return to the top!” that rides the page up and dings on arrival.
Give it your own label, and a target to stop at:
{{< elevator "Back to the header" my-header >}}Add the music, which is the point:
{{< elevator audio=music.mp3 volume=0.4 >}}See the Reference for every option, and the Examples for a button you can ride.
Where it works
HTML formats that carry JavaScript, which covers html and revealjs.
In every other format the shortcode renders nothing, which is the right outcome: a scroll button means nothing in a PDF.
Links
- Reference for the full option list.
- Examples for a working button.
- Changelog for what each release changed.
- Source and issues on GitHub.
Elevator.js is by Tim Holman, under the MIT Licence.