jQuery插件:scrollup

scrollup

一个简单的文字行向上滚动jQuery插件
这个也是为解决天成游戏玩家排名而写的

使用说明:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(function(){
$.fn.scrollup = function(options){
var defaults = {showcount:5,speed:1000,interval:3000},options = $.extend(defaults,options);
return this.each(function(){
var thisObj = $(this),intervalId = 0;
var sObj = {
_resetHtml:function(_t,_o){
_t.wrap("<div class='scrollWrap'></div>");
$(".scrollWrap").css({"height":parseInt(_o.showcount)*parseInt(_t.children().outerHeight())+"px","overflow":"hidden"});
},
_active:function(_t,_o){
_t.stop(true,true).animate({marginTop:parseInt(-_t.children().height())+"px"},_o.speed,function(){
$(this).css({"marginTop":0}).children(":first").appendTo(_t);
});
},
_bind:function(_t,_o){
var $t = this;
intervalId = setInterval(function(){
$t._active(_t,_o);
},_o.interval);
_t.hover(
function(){
clearInterval(intervalId);
},
function(){
intervalId = setInterval(function(){
$t._active(_t,_o);
},_o.interval);
}
);
},
init:function(obj,opt){
if(obj.children().length > opt.showcount){
this._resetHtml(obj,opt);
this._bind(obj,opt);
}
}
};
sObj.init(thisObj,options);
});
};
})(jQuery);
1
2
3
4
5
$("seleter").fn.scrollup({
showcount:5, // 默认显示行数
speed:1000, // 速度
interval:3000 // 间隔
});

源码地址