/******************************* * rollgallery * copyright (c) yeso! * date: 2010-10-13 ˵���� * ����԰�����Ԫ�ص�ֱ�ӹ�Ԫ��ӧ�ø÷��� * example: $("#picturewrap").rollgallery({ direction:"top",speed:2000,shownum:4,animethod:"easeoutcirc"}); * direction:�ƶ����򡣿�ȡֵϊ��"left" "top" * speed:�ٶȡ���λ���� * nostep:����ϊ��true �򰴷dz�����ʽ�������dz����¶���ч��ʧч�� * speedpx:�dz��������µ��ƶ��ٶȡ���λ���� * shownum:��ʾ����������Ԫ�������ɵ���Ԫ�ظ��� * rollnum:һ�ι����ĸ�����ע���ܸ�������ϊrollnum�ı����� * anispeed:�����ٶ� * animethod:�����������������磺easing��֧�֣� * childrensel:��Ԫ��ɸѡ�� *******************************/ ;(function($){ $.fn.rollgallery=function( options ){ var opts=$.extend({},$.fn.rollgallery.defaults,options); return this.each(function(){ var _this=$(this); var step=0; var maxmove=0; var animateargu=new object(); _this.intervalrgallery=null; if( opts.nostep&&(!options.speed) ) opts.speed=30; if( opts.direction=="left"){ step=_this.children( opts.childrensel ).outerwidth(true); }else{ step=_this.children( opts.childrensel ).outerheight(true); } maxmove=-(step*_this.children( opts.childrensel ).length); _this[0].maxmove=maxmove; if( opts.rollnum ) step*=opts.rollnum; animateargu[ opts.direction ]="-="+step; _this.children( opts.childrensel ).slice( 0,opts.shownum ).clone(true).appendto( _this ); _this.mouseover( function(){ clearinterval( _this.intervalrgallery ); }); _this.mouseout( function(){ _this.intervalrgallery=setinterval( function(){ if( parseint(_this.css( opts.direction ))<=maxmove ){ _this.css( opts.direction , "0px"); } if( opts.nostep ){ _this.css( opts.direction, (parseint(_this.css( opts.direction ))-opts.speedpx+"px") ); } else{ _this.animate( animateargu ,opts.anispeed,opts.animethod ); } }, opts.speed );}); _this.mouseout(); }); }; $.fn.rollgallery.defaults={ direction : "left", speed : 3000, nostep : false, speedpx : 1, shownum : 1, anispeed:"slow", animethod:"swing", childrensel:"*" }; })(jquery);