1
2
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<body>
<img data-original="images/001.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<img data-original="images/002.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<img data-original="images/003.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<img data-original="images/004.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<img data-original="images/005.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<img data-original="images/006.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<img data-original="images/007.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<img data-original="images/008.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<img data-original="images/009.jpg" src="js/grey.gif"
height="1077" border="0" />
<br />
<br />
<script src="js/jquery-1.7.js" type="text/javascript"
charset="utf-8"></script>
<script src="js/jquery.lazyload.js" type="text/javascript"
charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
$("img").lazyload({
effect : "fadeIn"
});
});
</script>
</body>
</body>
</html>

本文介绍了一种使用jQuery插件实现图片懒加载的方法。通过分析示例代码,读者可以了解如何利用jQuery及其懒加载插件使图片在滚动到可视区域时才加载,从而提高网页加载速度。
1746

被折叠的 条评论
为什么被折叠?



