无缝隙滚动代
横向
<div id="hot" style="overflow: hidden; width: 100%; color: #ffffff">
<table cellSpacing="0" cellPadding="0" align="left" border="0">
<tbody>
<tr>
<td id="divhot" valign="top">
内容 </td>
<td id="hot2" valign="top"> </td></tr></tbody></table></div>
<script type="text/javascript">
var hot = document.getElementById("hot");
var hot1 = document.getElementById("divhot");
var hot2 = document.getElementById("hot2");
var pause=0;
hot2.innerHTML=hot1.innerHTML;
function scrollMl()
{
if(hot2.offsetWidth-hot.scrollLeft<=0)
{
hot.scrollLeft-=hot1.offsetWidth;
}
else
{
hot.scrollLeft++;
}
}
function scrollMr()
{
if(hot.scrollLeft<=0)
{
hot.scrollLeft+=hot2.offsetWidth;
}
else
{
hot.scrollLeft--;
}
}
var hottime;
function doLeft()
{
clearInterval(hottime);
hottime=setInterval(scrollMl,20);
}
function doRight()
{
clearInterval(hottime);
hottime=setInterval(scrollMr,20);
}
hot.onmouseover=function(){clearInterval(hottime);}
hot.onmouseout=function(){hottime=setInterval(scrollMl,20);}
doRight();
</script>📱 扫码关注公众号
扫描二维码关注我们,获取更多精彩内容
实时更新 · 干货满满