关注前端开发
关注用户体验

无间隙文字向上滚动

<style type=”text/css”>

#rollText{font:12px;}

</style>

<div id=”rollAD” style=”height:40px; position:relative; overflow:hidden;”>

<div id=”rollText” style=”font-size:12px;line-height:20px;”>

<ul>

<li><a href=””>◇ 无间隙文字向上滚动</a></li>

<li><a href=””>◇ 无间隙文字向上滚动</a></li>

<li><a href=””>◇ 无间隙文字向上滚动</a></li>

<li><a href=””>◇ 无间隙文字向上滚动</a></li>

<li><a href=””>◇ 无间隙文字向上滚动</a></li>

<li><a href=””>◇ 无间隙文字向上滚动</a></li>

<li><a href=””>◇ 无间隙文字向上滚动</a></li>

</ul>

</div>

</div>

<script type=”text/javascript”>

var textDiv = document.getElementById(“rollText”);

var textList = textDiv.getElementsByTagName(“a”);

if(textList.length > 2){

var textDat = textDiv.innerHTML;

var br = textDat.toLowerCase().indexOf(“<li”,textDat.toLowerCase().indexOf(“<li”)+3);

textDiv.innerHTML = textDat+textDat+textDat.substr(0,br);

textDiv.style.cssText = “position:absolute; top:0”;

var textDatH = textDiv.offsetHeight;MaxRoll();

}

var minTime,maxTime,divTop,newTop=0;

function MinRoll(){

newTop++;

if(newTop<=divTop+40){

textDiv.style.top = “-” + newTop + “px”;

}else{

clearInterval(minTime);

maxTime = setTimeout(MaxRoll,5000);

}

}

function MaxRoll(){

divTop = Math.abs(parseInt(textDiv.style.top));

if(divTop>=0 && divTop<textDatH-40){

minTime = setInterval(MinRoll,1);

}else{

textDiv.style.top = 0;divTop = 0;newTop=0;MaxRoll();

}

}

</script>

赞(0)
未经允许不得转载:大前端 » 无间隙文字向上滚动
分享到: 更多 (0)

评论 5

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #5

    very interesting subject , appreciate it for putting up.

    Robbin Bouten2周前 (05-13)回复
  2. #4

    Hey there! I just wanted to ask if you ever have any issues with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no back up. Do you have any solutions to prevent hackers?

    Nonton Anime2周前 (05-10)回复
  3. #3

    This is my first time i visit here. I found so many informative stuffs on your blog, especially its discussion. Form the tons of comments and posts, I guess I am not the only one having all enjoyment here. Keep up the good work.

    rajapoker3周前 (05-03)回复
  4. #2

    It is really good post, but I don’t see everything completely clear, especially for someone not involved with that topic. Anyway very interesting in my experience.

    my singing monsters2个月前 (03-28)回复
  5. #1

    Aw, this was a really nice post. In idea I wish to put in writing like this additionally – taking time and precise effort to make a very good article… but what can I say… I procrastinate alot and on no account appear to get something done.

    Pilar Annan3个月前 (03-11)回复

themebetter 国内更好的WordPress主题服务商

立即前往