定时上下会停顿的滚动JS代码

<div style=”width:100%;height:30px;overflow:hidden;”>
<div id=”noticev2″ style=”white-space:nowrap;” onmouseover=”javascript:isMove=false”

onmouseout=”javascript:isMove=true”>
526互联 http://www.526net.com<br>
欧阳逍遥的个人博客是 https://blog.526net.com
</div>
</div>
<script>
var tID;
var tn;
var nStopTime=3000
var nSpeed=50
var isMove=true;
var nHeight=35;
var nS=0
var nNewsCount=0

function moveT(n)
{
clearTimeout(tID)
var noticev2= document.getElementById(“noticev2″)
if(n)
{
noticev2.style.lineHeight=nHeight+”px”;
var theText=noticev2.innerHTML.toLowerCase();  
nNewsCount=theText.split(“<br>”).length    
noticev2.innerHTML+=”<br>”+noticev2.innerHTML;
tn=nHeight;
}
nS=nSpeed;
if(isMove)
{
noticev2.style.marginTop=tn+”px”;
if((tn-2)%nHeight==0)
{
nS=nSpeed+nStopTime;
}

tn–;
if(Math.abs(tn)==(nNewsCount*nHeight*2-nHeight))
tn=(nNewsCount-1)*nHeight*-1;
}

tID=setTimeout(“moveT()”,nS);
}

moveT(1);
</script>

发表评论

您的电子邮箱地址不会被公开。