imagelightbox icon indicating copy to clipboard operation
imagelightbox copied to clipboard

Is there a way to avoid the 100ms timeout

Open walterjenner opened this issue 9 years ago • 5 comments

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?

walterjenner avatar Dec 09 '15 19:12 walterjenner

Sorry for not answering sooner. Did you try to remove the 100ms delay? Or does it break something?

rejas avatar Jan 31 '16 18:01 rejas

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)

walterjenner avatar Jan 31 '16 22:01 walterjenner

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?

rejas avatar Feb 01 '16 21:02 rejas

I could reproduce the error now. Without the delay the next image does not load/appear.

Still know idea, why..

walterjenner avatar Feb 01 '16 22:02 walterjenner

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.

hanwiz avatar Jul 22 '16 16:07 hanwiz

Hi, I think this should now be solved, the code doesn't rely on setTimeout nearly as much as it used to.

marekdedic avatar Mar 27 '24 22:03 marekdedic