ilyashubin/scrollbooster

How to get scroll position to use in slider navigation

Closed this issue · 1 comments

This is a brilliant plugin, just what I need. I'm using it as a horizontal slider on desktop, but want to show a navigation element below it which goes from 0% to 100% depending on the position of the scroller content.

Anybody know how to return a value from 0% to 100% on scroll?

I've checked out the onUpdate event, and can see the position.x shows 0 at the start, but can't figure out how to get 100%

As usual, I found the solution shortly after posting this. But here it is for others...

(state.position.x / (this.content.scrollWidth - this.content.offsetWidth)) * 100

Return the position of the scroll as a percentage.