复代码码 代码如下: <머리> 无标题文档 <br>ul,li{margin:0;padding:0} <br>#scrollDiv{width:300px;height:100px;min-height:25px;line-height:25px;border:#ccc 1px solid;overflow: 숨겨진} <br>#scrollDiv li{height:25px;padding-left:10px;} <br> <br>(함수($){ <br>$.fn.extend({ <br>Scroll:function(opt,callback){ <br>//参数初始化 <br>if(!opt) var opt={ }; <br>var _btnUp = $("#" opt.up);//Shawphy:向上按钮 <br>var _btnDown = $("#" opt.down);//Shawphy:向下按钮 <br> var 타이머ID <br>var _this=this.eq(0).find("ul:first"); <br>var lineH=_this.find("li:first").height(), //获取行높은 <br>line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数,默认为一屏, <br>即父容器고도 <br>speed=opt.speed?parseInt(opt.speed,10):500; //卷动速titude,数值越大,速島越慢(毫秒) <br>timer=opt.timer //? parseInt(opt.timer,10):3000; //사용 가능한 시간 <br>if(line==0) line=1; <br>var upHeight=0-line*lineH; /滚动函数 <br>var scrollUp=function(){ <br>_btnUp.unbind("click",scrollUp); //Shawphy:取消向按钮的函数绑定 <br>_this.animate({ <br>marginTop :upHeight <br>},speed,function(){ <br>for(i=1;i<=line;i ){ <br>_this.find("li:first").appendTo(_this); 🎜>} <br>_this.css({marginTop:0}); <br>_btnUp.bind("click",scrollUp); //Shawphy:绑定向上按钮的点击事件 <br>}); >} <br>//Shawphy:向下翻页函数 <br>var scrollDown=function(){ <br>_btnDown.unbind("click",scrollDown); <br>for(i=1;i<=line;i ){ <br>_this.find("li:last").show().prependTo(_this); <br>} <br>_this.css({marginTop:upHeight}); <br>_this.animate({ <br>marginTop:0 <br>},speed,function(){ <br>_btnDown.bind("click",scrollDown); <br>}); <br>} <br>//Shawphy:自动播放 <br>var autoPlay = function(){ <br>if(timer)timerID = window.setInterval(scrollUp,timer); <br>}; <br>var autoStop = function(){ <br>if(timer)window.clearInterval(timerID); <br>}; <br>//鼠标事件绑정 <br>_this.hover(autoStop,autoPlay).mouseout(); <br>_btnUp.css("cursor","pointer").click( scrollUp ).hover(autoStop,autoPlay);//Shawphy:向上向下鼠标事件绑定 <br>_btnDown.css("cursor", "포인터").click( scrollDown ).hover(autoStop,autoPlay); <br>} <br>}) <br>})(jQuery); <br>$(document).ready(function(){ <br>$("#scrollDiv").Scroll({line:4,speed:500,timer:3000,up:"btn2",down:"btn1 "}); <br>}); <br> <본문> 다행게임: 这是公告标题的第一行 这是公告标题的第4行 这是公告标题的第五行 아래로 업 件