Closed pavsid closed 3 years ago
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.
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 theposition.x
shows 0 at the start, but can't figure out how to get 100%