原文地址:http://www.maming.com/blog/2010/03/04/1267679226805.html

extend中$.fn.extend和$.extend

1.extend用一个参数和用几个参数是截然不同的,1个参数是函数定义;

2.用$.fn.extend实现的方法,调用的时候用 jQuery("div").myMethod();

3.用$.extend实现的方法,调用的时候jQuery.myMethod();

更多的可以看看

jQuery: $.extend() and $.fn.extend() confusion

这里是屏幕截图

animate的说明:

.animate( properties, [ duration ], [ easing ], [ callback ] )

properties:期望形成什么结果的CSS,也就是目标帧。至于怎么从当前的变,那就jquery的事情了,没有自己研究过。

duration:变化的时间,单位是毫秒。多长时间演完动画。这里有fast和slow,fast相当于200毫秒,slow相当于600毫秒

[ easing ]:没有用过。

callback:如果是间隔多少秒变化一次,这个函数主要功能就是设置下一次的起始状态。用于改变html代码

animate({marginTop:"-25px"},500,
function(){
$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
alert($("#scrollDiv1").html());
});

工作思路:

1.向上移动一行(设置顶部css为负数)

2.把第一行移动到最后一行(AppendTo)

3.重新设置为0(CSS的顶部0)

压缩包说明:

index.html,现在的文章

line1.html 单行滚动

linemore.html 多行滚动

linemoreupdonwbutton.html 带上下滚屏按钮的多行滚动

下 载