以一个小例子来展示滚动提示的代码部分:

try.html

<div >本活动将于2016年8月30日结束,如有抽奖机会,请尽快使用。&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp </span>
</div>

try.css

#scrollobj{
white-space:nowrap;
overflow:hidden;
width:100%;
height: 30px;
line-height: 30px;
background-color: #0553a9;
}
.scrollTxt{
width: 100%;
font-size: 16px;
color: #fff880;
}

try.js

function scroll(obj) {
var tmp = (obj.scrollLeft)++;
//当滚动条到达右边顶端时
if (obj.scrollLeft==tmp) { obj.innerHTML += obj.innerHTML;}
//当滚动条滚动了初始内容的宽度时滚动条回到最左端
if (obj.scrollLeft>=obj.firstChild.offsetWidth) { obj.scrollLeft=0; }

}
$interval(function(){
scroll(document.getElementById('scrollobj'));
},30);

相关文章:

  • 2021-11-27
  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
相关资源
相似解决方案