求助各位前辈小弟用一个DIV 绑定了图片 我现在想实现这个DIV的走马灯效果求代码求指点 先感谢各位[解决办
求助各位前辈
小弟用一个DIV 绑定了图片 我现在想实现这个DIV的走马灯效果求代码求指点 先感谢各位
[解决办法]
- HTML code
<style>#o{ width:500px;height:25px;overflow:hidden;}#o #i{width:1000px; height:25px}#o #i div{width:500px;height:25px; float:left;}</style><div id='o'><div id='i'><div id='s'>123456123456123456123456</div></div></div><script>var o = document.getElementById('o')var i = document.getElementById('i')var s = document.getElementById('s')var speed = 10i.appendChild(s.cloneNode(true));function scroll(){ if(o.scrollLeft >= o.offsetWidth) o.scrollLeft = 0 o.scrollLeft += 4;}var t = window.setInterval(scroll,speed)o.onmouseover = function(){window.clearInterval(t)}o.onmouseout = function(){t = window.setInterval(scroll,speed)}</script> 