Lazy load making pages freeze/load very slow on IE?

丶灬走出姿态 提交于 2019-12-25 03:02:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!