CSS scroll-state(scrolled) can detect scroll direction without JavaScript
In the source's words
`scrolled`: Queries whether a container was most recently scrolled in the given direction.
Source
developer.mozilla.org/en-US/docs/Web/CSS/Guides/Conditional_rules/Container_scroll-state_queries · T1
Find the quote on the page
Address
stacks.jakubdudek.com/sticky-header/c10
In a document: [[sticky-header#c10]]
JSON