Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazyload 图片懒加载的使用 #45

Open
mishe opened this issue Dec 9, 2015 · 0 comments
Open

lazyload 图片懒加载的使用 #45

mishe opened this issue Dec 9, 2015 · 0 comments

Comments

@mishe
Copy link
Owner

mishe commented Dec 9, 2015

图片懒加载

实现了当前页面的,也作用在动态的更新和加载的图片。

使用非常简单

步骤一

修改需要懒加载的图片的属性,增加一个名称为lazyload的class

步骤二

并把图片的src设置成通用的loading图片或者空白占位符图片

步骤三

把图片的真实地址,写入图片的data-img中

经过以上三部,图片的html代码变成如下格式:

//示例
<img src="loading.gif" data-img="a.jpg" class="lazyload">

步骤四

引入lazyload.js

步骤五

增加如下代码

$.imgLazyLoad()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant