先看效果,網址:
http:///keleyi/phtml/jquery/7.htm
更多參考:
http:///a/bjac/5b62295315de9ace.htm
完整代碼:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>背景圖片動畫</title>
<style type="text/css">
.animate{
height:300px;
width:600px;
background:url(http:///image/a/tvh00n12.jpg) no-repeat;
background-position:left center;
}
</style>
<script type="text/javascript" src="http:///keleyi/pmedia/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function () {
$('#start_keleyi_com').click(function () {
$("div#animate_ke"+"leyi_com").animate({ backgroundPosition: "400" }, "slow");
});
$('#back_keleyi_com').click(function () {
$("div#animate_ke" + "leyi_com").animate({ backgroundPosition: "0" }, "slow");
});
});
</script>
</head>
<body>
<div id="animate_keleyi_com" class="animate">背景圖片動起來, 各種源碼
<ul>
<li><span>▪</span><a href="http:///a/bjac/768f469b95b61487.htm" title="" >單行文字間歇向上滾動</a></li>
<li><span>▪</span><a href="http:///a/bjac/ed5eb8c2959c619e.htm" title="" >滾動頁面時DIV到達頂部時固定在頂部</a></li>
<li><span>▪</span><a href="http:///a/bjac/a6d651710217f7a0.htm" title="" >使用jQuery UI修飾title屬性的氣泡懸浮框</a></li>
<li><span>▪</span><a href="http:///a/bjac/bf0eb8c02085b10d.htm" title="" >jquery清空textarea等輸入框</a></li>
<li><span>▪</span><a href="http:///a/bjac/939631bb07adb4dc.htm" title="" >jquery關燈特效</a></li>
<li><span>▪</span><a href="http:///a/bjac/f4a6f78d74a251c5.htm" title="" >jquery根據滾動像素顯示隱藏頂部導航條</a></li>
<li><span>▪</span><a href="http:///a/bjac/7e8897e5ec0849e9.htm" title="" >可改變大小DIV層</a></li>
</ul>
</div>
<a id="back_keleyi_com" href="javascript:void(0)"><-動起來吧!</a> <a id="start_keleyi_com" href="javascript:void(0)">動起來吧!-></a>
</body>
</html>