目前的代码是无间断且无缝滚动的,怎么让它只执行一次,就停止。 $.fn.extend({ Scroll:function(opt,callback){ if(!opt) var opt={}; var _this=this.eq(0).find("ul:first"); var lineH=_this.find("li:first").height(), line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), speed=opt.speed?parseInt(opt.speed,10):500, timer=opt.timer?parseInt(opt.timer,10):2000; if(line==0) line=1; var upHeight=0-line*lineH; scrollUp=function(){ _this.animate({ marginTop:upHeight },speed,function(){ for(i=1;i<=line;i++){ _this.find("li:first").appendTo(_this); } _this.css({marginTop:0}); }); } _this.hover(function(){ clearInterval(timerID); },function(){ timerID=setInterval("scrollUp()",timer); }).mouseout(); } }) $(".top_txt").Scroll({line:2,speed:500,timer:1000}); 页面代码 第1行 第2行 第3行 第4行 第5行 第6行 想让它停在第最后两行就不再动了