首先html页面代码定义
<div class="navbar-inner" id="s" style="width:600px; position:relative; white-space:nowrap; overflow:hidden; height:60px;">
<div id="noticeList" style="position:absolute; top:0; height:20px;"> <span>截止目前:共提交问卷${alltotal}份,盐田${mt3total}份,蛇口${mt4total}份,赤湾${mt1total}份,大铲${mt2total}份。实时更新中~ </span><div>
</div>
Js代码
方法一:
$.fn.textScroll=
function
(){
var
speed=60,flag=
null
,tt,that=$(
this
),child=that.children();
var
p_w=that.width(), w=child.width();
child.css({left:p_w});
var
t=(w+p_w)/speed * 1000;
function
play(m){
var
tm= m==undefined ? t : m;
child.animate({left:-w},tm,
"linear"
,
function
(){
$(
this
).css(
"left"
,p_w);