JS不间断向上滚动效果代码

分类:Javascript| 发布:佚名| 查看: | 发表时间:2013/12/26
代码如下:

<div id=demo style=overflow:hidden;height:139;width:232;background:#f4f4f4;color:#ffffff><div id=demo1><img src="http://camnpr.com/upload/2013/12/201312261713288617.jpg"><img src="http://camnpr.com/upload/2013/12/201312261713295061.jpg"><img src="http://camnpr.com/upload/2013/12/201312261713298574.jpg"><img src="http://camnpr.com/upload/2013/12/201312261713291822.jpg"><img src="http://camnpr.com/upload/2013/12/201312261713300176.jpg"></div>
<div id=demo2></div>
</div>
<script>
var speed=50
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight
else{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>

http://camnpr.com/archives/815.html

365据说看到好文章不转的人,服务器容易宕机
原创文章如转载,请注明:转载自郑州网建-前端开发 http://camnpr.com/
本文链接:http://camnpr.com/archives/816.html