I had occasion to utilise an .svg file as a comic strip viewer, with the panels being a vertical strip to scroll through, and I wanted buttons for: a) restarting the UI-less slideshow, and b) going to a grid overview of all the panels.
I originally just made nine copies of the same two buttons, positioning each at the "same" point at the bottom of each panel, but then I saw that animation-timeline: scroll() recently landed in all browsers so decided to give that a go.
No critiques of the comic itself please, it's not mine:
https://imglink.cc/cdn/RLSQglSGwy.svg#p1
SVG <defs>:
<text id="rst">↻</text><text id="idx">📇</text>
SVG Content:
<g id="hud">
<a href="#slide" aria-label="Restart SLIDESHOW"><use href="#rst" x="5" y="680"/></a>
<a href="#Nav" aria-label="Go to OVERVIEW"><use href="#idx" x="326.5" y="677"/></a>
</g>
CSS:
@supports (animation-timeline: scroll()){
:root:has(image:target) #hud,:root:has(rect:target) #hud{
animation:hud-pin 1s linear both;animation-timeline:scroll(root block)
}
@keyframes hud-pin{0%{transform:translateY(0px)}100%{transform:translateY(5504px)}}
}