clerk icon indicating copy to clipboard operation
clerk copied to clipboard

Working on full HTML page only.

Open pavel-klavik opened this issue 6 years ago • 3 comments

It currently only works on the full element. In my website, I have a top panel which is always visible and the scroll area is below it. It would be great to allow clerk to be set on a custom element (both watching updates of scroll position and updating the scroll position after change of route).

pavel-klavik avatar Dec 22 '19 16:12 pavel-klavik

Indeed. I used an adapted Clerk in a project where I used an offset to compensate for a sticky top menu. Not exactly the same, granted, but anyway, I agree there should be some way to use vanilla Clerk with something else than full page apps.

The reason I didn't adapt Clerk to support my offset use case was that I didn't figure out a good API for it. So, here's a question back to you: What API would you prefer use for your use case? It will need to be backwards compatible with the current API, I think.

PEZ avatar Dec 22 '19 17:12 PEZ

Maybe let the user handle the events on their own when they need it?

So instead of running install-scroll-saver, one could bind this (or some modified function) to on-scroll event of any element. Here, it would need get the scroll position of an element, no the entire document.

Concerning scrolling, it could be caused on arbitrary element. I would just add optional argument to navigate-page!, on which element you want to cause the scroll.

pavel-klavik avatar Dec 22 '19 19:12 pavel-klavik

Seems I dropped this ball, right? No idea what happened back then, maybe Christman... Anyway, now reading your suggestion again and think it makes sense.

PEZ avatar Mar 07 '22 17:03 PEZ