Link progress bar to reading progress

Hi everyone,
I’m new to Weweb.
I wanted to know what is the best way to link a progress bar to the current position in the page to indicate how much of an article has been read.

I think you would need to compute the current scroll position divided by the full height of the page, convert it to a percentage, and bind it a div’s width which might have a background-color and reprensent the loader.

Here’s MDN docs on how to get the scroll position: Window: scrollY property - Web APIs | MDN

1 Like