Panorama: Preserve scroll position on toggle #363
Replies: 2 comments
-
Eliminating any inconvenience caused by using a feature (even momentarily) is something I'm interested in.
Let me see it and I'll see if I can optimise it down! Panorama is fairly simple anyway, introducing a little complexity is fine by me. |
Beta Was this translation helpful? Give feedback.
-
Okay, the code I wrote turns out to be simpler than I thought. I think the hard part about it is making it feel natural is just finding a way to run a function right after the correct DOM change if the effect you want to preserve scroll position through has asynchronous effects, but panorama's main function is synchronous anyway, and even if it wasn't, I actually understand the event loop now :P Here's the gist I helpfully made back in the good old days of August 2020, apparently thinking I would use it for more than one thing: https://gist.github.com/marcustyphoon/e04d2990d89c5a68b997d5c74dbe059d |
Beta Was this translation helpful? Give feedback.
-
Here's one of those really off-the-wall, niche feature ideas that just comes to you when you notice a minor inconvenience:
I mostly use panorama to see photo posts of webcomics or other art in a larger size than the tumblr lightbox(?) allows, but it's far too wide for me to use all the time. (I should write up my feature request for this as well. Anyway.)
This means that, when I do use the script, it's to toggle it on to look at a specific post. This results in the post I'm currently looking at being moved much farther down the screen then the current scroll position, meaning I have to go find it again. (I found this confusing even when I wasn't specifically trying to keep my place, but I probably toggle scripts when scrolled down way more than an average user.)
This could be prevented, albeit using quite a bit of code that would only be valuable to or even noticed by a microscopic percentage of users. Almost certainly not worth it. I have implemented code that does this before (during development on XK7's Show Originals PR, not sure if it's committed) so I do know it's possible.
Beta Was this translation helpful? Give feedback.
All reactions