Html 没有预加载

发布于 2024-09-24 19:47:53 字数 332 浏览 1 评论 0原文

我必须在 JQuery 中使用一些画廊(我正在使用 Galleria)。问题在于结构如下:

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

插件从该列表中获取所有照片并使用它们。问题:我有很多高质量的照片。所有它们都是在插件可以使用它们之前预加载的。有什么方法可以动态加载图像吗? (也许,一些新的画廊插件)。

I have to use some gallery with JQuery (I'm using 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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相思故 2024-10-01 19:47:53

这就是 jQuery LazyLoad 插件 派上用场的地方:)

Lazy loader 是一个 jQuery 编写的插件
在 JavaScript 中。它延迟加载
(长)网页中的图像。图片
视口之外(可见部分
网页)不会在用户之前加载
滚动到他们。这与
图像预加载。

在长网页上使用延迟加载
包含许多大图像使得
页面加载速度更快。浏览器将在
加载后可见就绪状态
图像。在某些情况下它也可以提供帮助
以减少服务器负载。

演示页面

That's where jQuery LazyLoad plugin comes in handy :)

Lazy loader is a jQuery plugin written
in JavaScript. 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文