그림 네 방향 틈새 없는 순환 스크롤 코드

13071 단어 코드
HTML
<div id=demo style=”overflow:hidden; width:128px; height:300px;”>
<div id=demo1>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
<img src=”gfjs.gif”><br><img src=”bxtt.gif”><br><img src=”bzjd.gif”><br>
</div>
<div id=demo2></div>
</div>

 
위쪽:프로그램 코드
<script language=”javascript”>
var speed=30
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>

 
아래로:프로그램 코드
<script language=”javascript”>
var speed=30
demo2.innerHTML=demo1.innerHTML
demo.scrollTop=demo.scrollHeight
function Marquee(){
if(demo1.offsetTop-demo.scrollTop>=0)
demo.scrollTop+=demo2.offsetHeight
else{
demo.scrollTop–
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>

 
왼쪽:프로그램 코드
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>

 
오른쪽: 프로그램 코드
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML
demo.scrollLeft=demo.scrollWidth
function Marquee(){
if(demo.scrollLeft<=0)
demo.scrollLeft+=demo2.offsetWidth
else{
demo.scrollLeft–
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>

좋은 웹페이지 즐겨찾기