完整DIV+CSS+JS不间断横向滚动代码:
横向不间断滚动DIV CSS代码-CSS5.scroll_div {width:600px; height:51px;margin:0 auto; overflow: hidden; white-space: nowrap; background:#ffffff;}
.scroll_div img {width:175px;height:51px;border: 0;margin: auto 8px; }
#scroll_begin, #scroll_end, #scroll_begin ul, #scroll_end ul,
#scroll_begin ul li, #scroll_end ul li{display:inline;}/* 设置ul和li横排 */
function ScrollImgLeft(){
var speed=20
var scroll_begin = document.getElementById("scroll_begin");
var scroll_end = document.getElementById("scroll_end");
var scroll_div = document.getElementById("scroll_div");
scroll_end.innerHTML=scroll_begin.innerHTML
function Marquee(){
if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
scroll_div.scrollLeft-=scroll_begin.offsetWidth
else
scroll_div.scrollLeft++
}
var MyMar=setInterval(Marquee,speed)
scroll_div.οnmοuseοver=function() {clearInterval(MyMar)}
scroll_div.οnmοuseοut=function() {MyMar=setInterval(Marquee,speed)}
}
CSS5演示说明:向左滚动
感谢好友分享CSS5快乐学习!