问题
I'm working on a Drupal site that had lazy load implemented into it because it is very image heavy. The feature works on every browser but IE, in which the page periodically freezes when scrolling down to see images due to a "long running script".
It seems like this is something of a known issue, but I can't seem to find a conclusive fix for the problem. Does anyone know if there is a known-workaround, or is this still a case-by-case fix?
回答1:
I assume you are using a lazyloader like jquery unveil. This plugin is known to be very lightweight, but also very resource intensive/inefficient.
You can change the lazyloading script to something more performant.
I'm the developer of https://github.com/aFarkas/lazysizes which shouldn't cause performance problems. Supported browsers: https://github.com/aFarkas/lazysizes#browser-support
回答2:
If you also need IE8 support, I suggest you to use justlazy, which is very lightweight and doesn't use jQuery.
It's very easy to use:
1. Define placeholder of your choice
<span data-src="default/image" data-alt="some alt text"
class="justlazy-placeholder">
</span>
2. Register lazy loading of placeholder(s)
Justlazy.registerLazyLoadByClass("justlazy-placeholder");
There are some options available and you can SEO optimize your placeholder due to use an img as placeholder.
来源:https://stackoverflow.com/questions/33425169/lazy-load-making-pages-freeze-load-very-slow-on-ie