首页 >web前端 >js教程 >js+div实现图片滚动效果代码_javascript技巧

js+div实现图片滚动效果代码_javascript技巧

WBOY
WBOY原创
2016-05-16 17:01:001112浏览

横向

onmouseout="doscroll()">




<script> <BR>var t=demo.scrollWidth <BR>demo1.innerHTML+=demo1.innerHTML <BR>function doMarquee() <BR>{ <BR>demo.scrollLeft=demo.scrollLeft<demo.scrollWidth-demo.offsetWidth?demo.scrollLeft+1:t-demo.offsetWidth <BR>} <BR>function doscroll() <BR>{ <BR> sc=setInterval(doMarquee,20) <BR>} <BR>function stopscroll() <BR>{ <BR> clearInterval(sc) <BR>} <BR>doscroll() <BR></script>


纵向




<script> <BR>var speed=100 <BR>demo2.innerHTML=demo1.innerHTML <BR>function Marquees(){ <BR>if(demo2.offsetTop-demo.scrollTop<=0) <BR>demo.scrollTop-=demo1.offsetHeight <BR>else{ <BR>demo.scrollTop++ <BR>} <BR>} <BR>var MyMars=setInterval(Marquees,speed) <BR>demo.onmouseover=function() { clearInterval(MyMars) } <BR>demo.onmouseout=function() { MyMars=setInterval(Marquees,speed) } <BR>zlselect('6'); <BR></script>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn