YUYISHARE 2010-11-19
代码如下:
<a href="#nogo"><img alt="//www.jb51.net/comstyles/img200-150-3.jpg" src="http://sc.jb51.net/style/img/spacer.gif" alt="200-150" /></a> <a href="#nogo"><img alt="//www.jb51.net/comstyles/img200-150-4.jpg" src="http://sc.jb51.net/style/img/spacer.gif" alt="200-150" /></a>
代码如下:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="lazyload.js"></script> <script type="text/javascript"> //初始化代码 $(document).ready(function(){ $("#lazy1 img,#lazy2 img").lazyload({ placeholder : "http://sc.jb51.net/style/img/spacer.gif", effect : "fadeIn" }); }); </script>
代码如下:
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>无标题文档</title> <style type="text/css"> img{ display:block; border:2px solid #ccc; margin:0 0 10px;} </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="lazyload.js"></script> <script type="text/javascript"> //初始化代码 $(document).ready(function(){ $("#lazy1 img,#lazy2 img").lazyload({ placeholder : "http://qsl.cn/style/img/spacer.gif", effect : "fadeIn" }); }); </script> </head> <body> <div style=" height:900px; width:400px; background:#eee;"> <a href="#nogo"><img src="http://www.titan24.com/comstyles/img200-150-2.jpg" alt="200-150" /></a> 第一屏高度为900px,滚动到下面的时候,相应图片才开始加载 </div> <div id="lazy1" style="width:350px; margin-bottom:340px;"> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/ad400-300.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="400-300" /></a> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/img200-150-1.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="200-150" /></a> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/img200-150-2.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="200-150" /></a> </div> <div id="lazy2" style="width:350px;"> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/img200-150-3.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="200-150" /></a> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/img200-150-4.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="200-150" /></a> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/img560-300-1.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="200-150" /></a> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/img560-300-2.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="200-150" /></a> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/img560-300-3.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="200-150" /></a> <a href="#nogo"><img alt="http://www.titan24.com/comstyles/img560-300-4.jpg" src="http://qsl.cn/style/img/spacer.gif" alt="200-150" /></a> </div> </body> </html>