imagelightbox
imagelightbox copied to clipboard
Is there a way to avoid the 100ms timeout
In line 229 there is a timeout duration of "options.animationSpeed + 10". That makes the image preloading kind of useless - is there a way avoid this delay?
Sorry for not answering sooner. Did you try to remove the 100ms delay? Or does it break something?
Yes I did - any it did break something. Not sure what exactly, though. If I set no delay in the code right now, it seems to work in my project. But last time I checked, I had some problems - i set the delay to 30ms, which did not cause problems (but my project is not live yet).
Sorry, for the diffuse answer :) I guess the delay is there for a reason, but I cannot see it at the moment (late at night)
Since I only copied the code from the original author I am not sure why the delay either. How does the breakage manifest itself in your project?
I could reproduce the error now. Without the delay the next image does not load/appear.
Still know idea, why..
I think this is related to the image sliding animation. It is sliding the image and then remove it with the options.animationSpeed. If you remove the 100ms, loading and removing is done at the same time. This causes undefined behavior - I mean, image can or cannot appear.
Hi, I think this should now be solved, the code doesn't rely on setTimeout
nearly as much as it used to.