5.5
练习使用js 代码
代码展示:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>图片向上翻滚效果</title>
<style type="text/css">
.father{
position:relative;
overflow:hidden;
height:100px;
width:300px;
}
.box item{
float: left;
font-size: 12px;
width: 80px;
height: 120px;
overflow: hidden;
position:absolute;
}
</style>
<script language="javascript" type="text/javascript">
var t;
window.onload = function(){
var o = document.getElementById('box');
t = window.setInterval(function(){
scrollup(o, 24, 0);
}, 3000)
}
///滚动主方法
///参数:o 滚动块对象
///参数:d 每次滚屏高度
///参数:c 当前已滚动高度
function scrollup(o, d, c){
if (d == (c - 78 )) {
var t = getFirstChild(o.firstChild).cloneNode(true);
o.removeChild(getFirstChild(o.firstChild));
o.appendChild(t);
t.
