jquery延时加载
代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JqueryTest.aspx.cs" Inherits="JqueryTest" %>
<!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 runat="server">
<title>Jquery</title>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="js/jquery.lazyload.mini.js"></script>
<script type="text/jscript">
$(function()
$("img").lazyload({
placeholder : "Image/default.jpg", //沒有加載前的圖片
event : "yanshi"
});
$("img").load(function(){
setTimeout(function() {$("img").trigger("yanshi")},3000); //3秒后加載所有圖片
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="id1">
jquery實現圖片延時加載<br />
<br />
</div>
<div>
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
</div>
</div>
</form>
</body>
</html>
<!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 runat="server">
<title>Jquery</title>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="js/jquery.lazyload.mini.js"></script>
<script type="text/jscript">
$(function()
$("img").lazyload({
placeholder : "Image/default.jpg", //沒有加載前的圖片
event : "yanshi"
});
$("img").load(function(){
setTimeout(function() {$("img").trigger("yanshi")},3000); //3秒后加載所有圖片
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="id1">
jquery實現圖片延時加載<br />
<br />
</div>
<div>
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
<img src="Image/mds.jpg" width="104" height="76px" alt="" />
</div>
</div>
</form>
</body>
</html>
要下载个lazyload.mini.js 和jquery-1.4.2.js包