<!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" />
<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 {
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.style.marginTop = "0px";
}
else {
c += 1;
getFirstChild(o.firstChild).style.marginTop = -c + "px";
window.setTimeout(function(){
scrollup(o, d, c)
}, 15);
}
}
//解决firefox下会将空格回车作为节点的问题
function getFirstChild(node){
while (node.nodeType != 1) {
node = node.nextSibling;
}
return node;
}
</script>
</head>
<body>
滚动定时效果演示
<hr>
<div class="father">
<div id="box">
<div class="item">
<img src="../img/head/1.png"/>
</div>
<div class="item">
<img src="../img/head/2.png"/>
</div>
<div class="item">
<img src="../img/head/3.png"/>
</div>
<div class="item">
<img src="../img/head/4.png"/>
</div>
</div>
</div>
</body>
</html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有