jQuery图片滚动图片的效果(另类实现)

2020-05-17 06:27:45易采站长站整理

                 this.index–;
                 var step = this.history.pop();//取最后的移动步骤
                 var move =  step * this.width;//算出移动宽度
                 this.el.find(“ul”).animate( { “left” : “+=”+move+”px” } , this.config.speed )
             } , this));
         },
         next : function(){
             this.el.find(‘[data-type=”right”]’).click( $.proxy(function(){
                 //如果是当前的最后一页,直接return
                 if(this.index == parseInt( this.length / this.config.view , 10 ) ){
                     return;
                 }
                 this.index++;
                 //这个计算很重要
                 //计算 ( 下一页 * view ) 展示个数是否大于总长度 : 好比当前在第一页 (1+1) *7 > 12(总长度)
                 //则this.step 赋值为取余 ,也就是剩下要移动的个数
                 if( this.config.view * (this.index+1) > this.length ){
                     this.step =  this.length%this.config.view;
                 }else{
                     //否则移动展示的个数
                     this.step = this.config.view;
                 }
                 //记录移动的历史记录