<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Scroll2.ascx.cs" Inherits="Controller_WebUserControl" %>
<div style="height:100%;width:100%">
<div id="colee" style="overflow:hidden;height:500px;width:190px;">
<div id="colee1">
<div style="width:80px; height:60px">
<p>
<img height="60px" width="75px" src='image/014.jpg'/>
<img height="60px" width="75px" src='image/015.jpg'/>
<img height="60px" width="75px"src='image/016.jpg'/>
<img height="60px" width="75px"src='image/017.jpg'/>
<img height="60px" width="75px"src='image/018.jpg'/>
<img height="60px" width="75px"src='image/019.jpg'/>
<img height="60px" width="75px"src='image/020.jpg'/>
<img height="60px" width="75px"src='image/021.jpg'/>
</p>
</div>
</div>
<div id="colee2"></div>
</div>
</div><script>
var speed = 30;
var colee2 = document.getElementById("colee2");
var colee1 = document.getElementById("colee1");
var colee = document.getElementById("colee");
colee2.innerHTML = colee1.innerHTML; //克隆colee1为colee2
function Marquee1() {
//当滚动至colee1与colee2交界时
if (colee2.offsetTop - colee.scrollTop <= 0) {
colee.scrollTop -= colee1.offsetHeight; //colee跳到最顶端
} else {
colee.scrollTop++;
}
}
var MyMar1 = setInterval(Marquee1, speed);//设置定时器
//鼠标移上时清除定时器达到滚动停止的目的
colee.onmouseover = function () { clearInterval(MyMar1) }
//鼠标移开时重设定时器
colee.onmouseout = function () { MyMar1 = setInterval(Marquee1, speed) }
</script>这个静态写死的就可以正常移动现实!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货