electerious / basicLightbox

The lightest lightbox ever made.

Home Page:https://basiclightbox.electerious.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option to preload images

jSchez opened this issue · comments

commented

Hello there !

First of all, congratulations for this great plugin. I really like it :)

I want to share a suggestion on certain scenario. In my case, I usually use this plugin as a Lightbox, and I miss a feature to preload images before they are rendered.

If you have any plans to do this and I can help you doing it, please let me know, I will be glad to help.

Thank you in advance !

PS: I attach you the piece of code that I use. Sorry for jQuery, in the web I still use the traditional stack 🐼.

https://pastebin.com/R2GFbRii

i actually like the fact that basicLightbox does just one thing and use another specialized library (justLazy) for that other problem.

commented

Yeah, I agree with you. It is usually best to keep simple things simple. But in case the modal is loading an image, usually a high res one, then I think that making the image preload is not so out of scope at all.

that is imo also obviously in the domain of a lazy loading library that often provide this functionality.

Glad you like basicLightbox :) It's possible to preload images, but as @funkyfuture said, this isn't and shouldn't be part of the library. I recommend to build your preloading logic around it.