DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS詳解 >> 圖片左右循環連續滾動代碼,解決marquee的留白問題
圖片左右循環連續滾動代碼,解決marquee的留白問題
編輯:CSS詳解     

向上:
<base

href="http://image2.sina.com.cn/gm/lineage2/whz/newwh/images/fy/images/images/ifimage/">

<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>

向下:
<base

href="http://image2.sina.com.cn/gm/lineage2/whz/newwh/images/fy/images/images/ifimage/">

<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
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>

向左:
<base

href="http://image2.sina.com.cn/gm/lineage2/whz/newwh/images/fy/images/images/ifimage/">
<div id=demo style="overflow:hidden;height:100px;width:300px;"><table align=left

cellpadding=0 cellspace=0 border=0><tr><td id=demo1 valign=top><img src="gfJS.gif"><img

src="bxtt.gif"><img src="bzjd.gif"><img src="gfJS.gif"><img src="bxtt.gif"><img

src="bzjd.gif"></td><td id=demo2 valign=top></td></tr></table></div>
<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>

向右:
<base

href="http://image2.sina.com.cn/gm/lineage2/whz/newwh/images/fy/images/images/ifimage/">
<div id=demo style="overflow:hidden;height:100px;width:300px;"><table align=left

cellpadding=0 cellspace=0 border=0><tr><td id=demo1 valign=top><img src="gfJS.gif"><img

src="bxtt.gif"><img src="bzjd.gif"><img src="gfJS.gif"><img src="bxtt.gif"><img

src="bzjd.gif"></td><td id=demo2 valign=top></td></tr></table></div>
<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>

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved