scrollProgress icon indicating copy to clipboard operation
scrollProgress copied to clipboard

Multiple progress bar on the same page?

Open geosigno opened this issue 6 years ago • 5 comments

Would it be possible to use 2 or more progress bars in the same page.

For example on a page with 3 articles, each one should have its progress bar. So if the first article is finish, the progress start again with the second . Also if you scroll up, then the progress bar adapt accordingly?

geosigno avatar Sep 22 '17 11:09 geosigno

With the last version it's possible to create as many progress observers as you want, though right now it's not possible to add offsets so they track specific parts of the page, but it's something I'm working right now and expect to release soon.

jeremenichelli avatar Sep 22 '17 13:09 jeremenichelli

That's a good new :) Any idea of the release date?

geosigno avatar Sep 28 '17 12:09 geosigno

Not yet, I gave it a try a while ago but the solution was super buggy.

I hope to have the time to try again soon.

jeremenichelli avatar Sep 28 '17 13:09 jeremenichelli

I found a way, I put the code here if it can help you to add this feature if your library ;)

https://codepen.io/anon/pen/pWwgyQ

geosigno avatar Sep 29 '17 10:09 geosigno

Wow! Really cool @geosenna, I'm trying to come up with a way that you can pass coordenates to the observer so it tracks specific areas of the page.

Something like:

const observer = new scrollProgress({
  top: 200,
  bottom: 600,
  onUpdate(x, y) {
    console.log(x, y)
  } 
})

So this way it serves to all purposes, not only reading progress bars. Another option would be to optionally pass a DOM node and track that, update on resize.

Food for thought.

jeremenichelli avatar Sep 29 '17 13:09 jeremenichelli