lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.22k stars 1.77k forks source link

Performance issues in IE #575

Closed bogdanbikics closed 6 years ago

bogdanbikics commented 7 years ago

Hi,

with my colleagues we found an issue with lightbox. In IE 11 (maybe also lower) it has some weird performance problems: if you click on a picture once to lightbox it, Explorer will be busy with painting in an infinitive loop (even if you leave the given page), causing quite some CPU usage. On the picture you can see the UI responsiveness chart where I don't do anything just looking at the page.

lightboxissue

After some investigation I found a solution. If I remove this line from lightbox.css:

body:after {
  content: url(../images/close.png) url(../images/loading.gif) url(../images/prev.png) url(../images/next.png);
  display: none;
}

then it won't have any problems anymore. I am not sure why it is difficult for IE, my guess is that it just can't handle it and tries it over and over again. We changed it locally in our own project, but we wanted to inform you too. (maybe later we might also want to use it from npm/bower :) )

Thank you in advance and best wishes!

lokesh commented 6 years ago

Old issue. But I want to say, thank you for investigating.

I have removed the offending code in a recent PR. The code was originally used as a hack for preloading images via CSS. This isn't necessary any more as the images are loaded once the lightbox markup is appended to the DOM which is on dom ready.

PR: https://github.com/lokesh/lightbox2/pull/612

lokesh commented 6 years ago

Resolved: https://github.com/lokesh/lightbox2/releases/tag/v2.10.0