js的无间隙滚动,为什么高度设置到230就不行了,不能滚动???
<div id=demo style=overflow:hidden;height:100;width:170> <div id=demo1> //这里的高度100的时候没有问题,但是再高点就不行了,怎么改?
<img src= "images/flash8.gif ">
<img src= "images/link/flashempire.gif ">
<img src= "images/linklogo/shlogo.gif ">
<img src= "images/link/deskcity.gif ">
<img src= "images/link/flashempire.gif ">
<img src= "images/linklogo/shlogo.gif ">
<img src= "images/link/deskcity.gif ">
<img src= "images/link/flashempire.gif ">
<img src= "images/linklogo/shlogo.gif ">
<img src= "images/link/deskcity.gif ">
</div>
<div id=demo2> </div>
</div>
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML //克隆demo1为demo2
function Marquee(){
if(demo2.offsetTop-demo.scrollTop <=0) //当滚动至demo1与demo2交界时
demo.scrollTop-=demo1.offsetHeight //demo跳到最顶端
else{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed) //设置定时器
demo.onmouseover=function() {clearInterval(MyMar)}//鼠标移上时清除定时器达到滚动停止的目的
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}//鼠标移开时重设定时器
</script>
------解决方案--------------------上界大概是132
你加上
function Marquee(){
window.status=demo2.scrollTop+ "| "+demo2.offsetTop+ "| "+demo.scrollTop+ "| "+demo.offsetTop
运行时看看状态栏先
------解决方案--------------------如果 demo2.offsetTop 大于 demo.Height 应该就可以了。