照片如何加载缓慢?例如,Facebook照片先加载,然后逐渐变满。 [英] How are the photos load slowly? For instance, Facebook photos are loaded first, and then gradually become full.

查看:158
本文介绍了照片如何加载缓慢?例如,Facebook照片先加载,然后逐渐变满。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

照片如何加载缓慢?例如,Facebook照片首先加载,然后逐渐变满。

How are the photos load slowly? For instance, Facebook photos are loaded first, and then gradually become full.

推荐答案

有几种方法可以实现这一点。

有一个名为 lowsrc IMG 标签的属性。这意味着首先加载,而不是由 src 属性中的图像替换。不幸的是,现代浏览器忽略了它;仍然可以使用javascript工作,请参阅: http:/ /blog.throbs.net/2009/05/27/Hey+JLo+Where+Did+LowSRC+Go.aspx [ ^ ];

另一种方法甚至更好:只有在视口中滚动图像时才会加载全分辨率图像: http://www.appelsiini.net/projects/lazyload [ ^ ]

你也可以依靠jpg本身: http://calendar.perfplanet.com/2012 / progressive-jpegs-a-new-best-practice / [ ^ ],但支持不是t他在浏览器中也一样。
There are several approaches to achieve this.
There is an attribute of IMG tag called lowsrc. It was meant to be loaded first, than replaced by the image in the src attribute. Unfortunately, modern browsers are ignoring it; still you can make it work with javascript, see: http://blog.throbs.net/2009/05/27/Hey+JLo+Where+Did+LowSRC+Go.aspx[^];
An other approach is even better: the full-res images are loaded only when the image is scrolled in the viewport: http://www.appelsiini.net/projects/lazyload[^]
You can also rely on jpg itself: http://calendar.perfplanet.com/2012/progressive-jpegs-a-new-best-practice/[^], but the support is not the same across browsers.


这篇关于照片如何加载缓慢?例如,Facebook照片先加载,然后逐渐变满。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆