francoischalifour / medium-zoom

🔎🖼 A JavaScript library for zooming images like Medium
https://medium-zoom.francoischalifour.com
MIT License
3.59k stars 164 forks source link

Add support for browser back button #50

Open simonhermann opened 6 years ago

simonhermann commented 6 years ago

Since images open in a fullscreen view, users'd expect the browsers back button to bring them back to non-zoomed state. I found this is especially true on Android, intuitively using the back button all the time.

Browser history API on MDN Listening to back event

francoischalifour commented 6 years ago

That's an interesting feature, thanks!

I wonder if this behavior is expected from most users. Adding some sort of router option could be possible to support this.

I don't want to drift from the original intent of this library though: providing the same user experience as Medium's zoom.

If you really believe in such a feature, I suggest you hack a little POC either:

Let me know what you think!