话说这个似乎前一阵很流行.贴下代码吧.
<script type="text/javascript">
jQuery(function($) {
/* Scrolling Background */
var currentOffset = [0, 0];
var backgroundImage = new Image();
var updateBackground = function() {
currentOffset[0] = currentOffset[0] - 1 % backgroundImage.width;
var attributeString = currentOffset[0] + "px " + currentOffset[1] + "px";
$('body').css('background-position', attributeString);
setTimeout(updateBackground, 100);
};
backgroundImage.onload = function () {updateBackground();}
backgroundImage.src = "_static/TekapoSky.jpg";});
</script>
贴一下结构和css,其实无关结构的..
<style type="text/css">
body.oriontransfer {
width: auto;
height: auto;
background-image: url("_static/TekapoSky.jpg");
}
#header {
height: 160px;
background-image: url("_static/logo.png");
background-repeat: no-repeat;
background-position: 50px 50px;
position: relative;
}
</style>
<!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>
<script src="_static/jquery-1.4.4.min.js" type="text/javascript"></script>
</head>
<body class="oriontransfer">
<div id="header">
<img src="_static/space-ship.png" id="space-ship">
</div>
</body>
</html>
打包脚本下载:[download id=“104”]