js 不间断向上滚动效果代码示例

发布时间:2020-10-06编辑:脚本学堂
js不间断向上滚动效果的实现代码,图片不间断向上滚动特效,纯js实现的网页特效代码。

如下:
 

复制代码 代码示例:
<div id=demo style=overflow:hidden;height:139;width:232;background:#f4f4f4;color:#ffffff><div id=demo1><img src="http://www.plchome.org/down/js/images/12460764740.jpg"><img src="http://www.plchome.org/down/js/images/12460764741.jpg"><img src="http://www.plchome.org/down/js/images/12460764742.jpg"><img src="http://www.plchome.org/down/js/images/12460764743.jpg"><img src="http://www.plchome.org/down/js/images/12460764744.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>
<p><a href="http://www.jb200.com/jb/" target="_blank">脚本学堂</a></p>