js 异步加载 延迟执行 插件
2012-07-05 13:47:37 来源:WEB开发网核心提示:调用代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ht
调用代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>去网游,专注游戏攻略技巧 - www.7wy.net</title>
<script type="text/javascript" src="Scripts/asynload.js"></script>
</head>
<body>
<div id="container">
<img src="images/bmw_m1_hood.jpg" width="765" height="574" alt="BMW M1 Hood">
<script type="text/asynjs" order="3" asynsrc="test.js"></script>
<script type="text/asynjs" order="1" asynsrc="Scripts/jquery-1.7.2.js"></script>
<script type="text/asynjs" order="2" asynsrc="Scripts/jquery.lazyload.js"></script>
<img src="images/bmw_m1_side.jpg" width="765" height="574" alt="BMW M1 Side" />
<img data-original="images/viper_1.jpg" width="765" height="574" alt="Viper 1" />
<img data-original="images/viper_corner.jpg" width="765" height="574" alt="Viper Corner" />
<img data-original="images/bmw_m3_gt.jpg" width="765" height="574" alt="BMW M3 GT" />
<img data-original="images/corvette_pitstop.jpg" width="765" height="574" alt="Corvette Pitstop" />
</div>
</body>
</html>
其中jquery.lazyload.js是图片延迟加载的jquery插件。test.js的代码$(function () {$("img[data-original]").lazyload();});。

IE9下执行结果:
更多精彩
赞助商链接
