auto=opt.auto!=null?opt.auto:true,//是否自动滚动,默认自动
cycle=opt.cycle!=null?opt.cycle:true,//是否循环滚动,默认循环
speed=opt.speed!=null?parseInt(opt.speed,10):500; //卷动速度,数值越大,速度越慢(毫秒)
timer=opt.timer!=null?opt.timer:3000; //滚动的时间间隔(毫秒)
if(line==0) line=1;
var upHeight=0-line*lineH;
var liCount=_this.find("li").length;//LI的总数
var showCount=parseInt(this.height()/lineH);//显示出来的LI数量
var currentCount=showCount;
var scrollUp=function(){
if(!cycle && currentCount>=liCount) return;
_btnUp.unbind("click",scrollUp);
_this.animate({
marginTop:upHeight
},speed,function(){
for(i=1;i<=line;i++){
if(!cycle && currentCount>=liCount) break;
currentCount++;
_this.find("li:first").appendTo(_this);
}
_this.css({marginTop:0});
_btnUp.bind("click",scrollUp);
});
}
var scrollDown=function(){
if(!cycle && currentCount<=showCount) return;
_btnDown.unbind("click",scrollDown);
for(i=1;i<=line;i++){
if(!cycle && currentCount<=showCount) break;
currentCount--;
_this.find("li:last").show().prependTo(_this);
}
_this.css({marginTop:upHeight});
_this.animate({
marginTop:0
},speed,function(){
_btnDown.bind("click",scrollDown);
});
}
var autoPlay = function(){
if(auto) {
if(timer>0) timerID = window.setInterval(scrollUp,timer);
}
};
var autoStop = function(){
if(timer)window.clearInterval(timerID);
};
_this.hover(autoStop,autoPlay).mouseout();
_btnUp.css("cursor","pointer").click( scrollUp ).hover(autoStop,autoPlay);
_btnDown.css("cursor","pointer").click( scrollDown ).hover(autoStop,autoPlay);
}
})
})(jQuery);

总结
到此这篇关于jQuery实现中奖播报(让文本滚动起来) 简单设置数值即可的文章就介绍到这了,更多相关jquery 中奖播报 滚动内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!










