Hi Leonardo,
I wrote about the same topic a while ago.
I chose to use <progress> rather than <div>. It is better for accessibility, but requires more effort to style.
<progress>
<div>
I discussed optimization using requestAnimation and debouncing also.
requestAnimation
I would consider doing both of these if you are putting this into a live website.
All the best
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Leonardo,
I wrote about the same topic a while ago.
Make a Reading Progress Bar for your Blog 📊
Rob OLeary ・ Apr 21 '20 ・ 5 min read
I chose to use
<progress>
rather than<div>
. It is better for accessibility, but requires more effort to style.I discussed optimization using
requestAnimation
and debouncing also.I would consider doing both of these if you are putting this into a live website.
All the best