I am curious to understand why you say you “can’t use gallery” in this situation. I understand you have a clearly strong preference for the page to not reload (and I agree with you) but, while perhaps not a perfect solution, it does not stop you from browsing images.