dimsemenov / PhotoSwipe

JavaScript image gallery for mobile and desktop, modular, framework independent
http://photoswipe.com
MIT License
24.18k stars 3.31k forks source link

prevent switching to next image before previous image is loaded when holding arrow navigation #1681

Open KarlBaumann opened 4 years ago

KarlBaumann commented 4 years ago

Hi!

I have a website where I list photos taken by my security camera. Every evening I loop through them by just holding the arrow button on the keyboard to quickly see what has happened during the day. I noticed that even though I have set "preload" option to [150, 150], and these photos are indeed pre-download, still I experience some tiny photo loading delay when I hold the arrow button. It does not happen for the cached photos though.

When I hold the button, I can see that captions are changing, but images are not being displayed fast enough.

I am not sure what is the best solution to fix this, but one of the solutions would be to switch to next photo only when the previous one has loaded.

Can somebody recommend an approach to achieve that?

step135 commented 1 year ago

It is not a good way to block going to next preview. The better way is to show firstly the small image from preview and when the big one is loaded, replace it.