简体   繁体   English

HTML无预加载

[英]Html no preloading

I have to use some gallery with JQuery (I'm using Galleria). 我必须在JQuery中使用一些图库(我在使用Galleria)。 The problem is that the structure is like: 问题在于结构如下:

<div id="galleria">
   <img src="(...).jpg" />
   <img src="(...).jpg" />
   <img src="(...).jpg" />
   <!-- ... -->
</div>

The plugin takes all photos from that list and use them. 该插件会从列表中获取所有照片并使用。 The problem: I have a lot of high-quality photos. 问题:我有很多高质量的照片。 And all they are preloaded before plugin can use them. 并且在插件可以使用它们之前将它们预先加载。 Are there any ways to load images dynamically? 有什么方法可以动态加载图像? (Maybe, some new gallery plugin). (也许是一些新的画廊插件)。

That's where jQuery LazyLoad plugin comes in handy :) 那就是jQuery LazyLoad插件派上用场的地方:)

Lazy loader is a jQuery plugin written in JavaScript. 惰性加载器是用JavaScript编写的jQuery插件。 It delays loading of images in (long) web pages. 这会延迟(长)网页中图像的加载。 Images outside of viewport (visible part of web page) wont be loaded before user scrolls to them. 视口外(网页的可见部分)的图像在用户滚动到它们之前不会被加载。 This is opposite of image preloading. 这与图像预加载相反。

Using lazy load on long web pages containing many large images makes the page load faster. 在包含许多大图像的长网页上使用延迟加载可以使页面加载更快。 Browser will be in ready state after loading visible images. 加载可见图像后,浏览器将处于就绪状态。 In some cases it can also help to reduce server load. 在某些情况下,它还可以帮助减少服务器负载。

Demo Page 演示页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM