Recommended Javascript Image preloader [closed]

…衆ロ難τιáo~ 提交于 2019-12-08 14:50:38

问题


There are a couple of tools and several tutorials (even some including links to github) on how to preloading images and other artifacts, like css and scripts. YUI3 preloader seems to be the most reliable one.

Is there a better one? Are there any others that are faster (possibly through parallel loading), more usable or has better browser compatibility? Maybe one that uses jquery instead of YUI...


回答1:


I like the jquery preload plugin. Try this.........

http://plugins.jquery.com/project/Preload




回答2:


As a suggestion, you can use a lazy loader such as this one to only load images once they are have been scrolled and are in the viewport.




回答3:


This one is the best.

(new Image).src = '/path/to/image/to/preload';

To preload other things (thanks Daniel) you can try this:

document.createElement('object').data = '/path/to/resource/to/preload';


来源:https://stackoverflow.com/questions/3536162/recommended-javascript-image-preloader

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