特色服务

scrollContent:摇滚动的块,一个DOM对象,这里是ol * imgHeight:每一张图片的高度,当然,如果想改成左右滚动,这里传入每一张图片的宽,唯一需要注意的是每一张图片宽高必须相同,图片数量可调整 * timeout:切换速度快慢,默认为1.5ms * hoverClass:每一个按钮激活时的类名 */ hoverClass = hoverClass || 'active'; timeout = timeout || 1500; this.btns = btns; this.scrollContent = scrollContent; this.hoverClass = hoverClass; this.timeout = timeout; this.imgHeight = imgHeight; var _this = this; for(var i=0; i= this.btns.length) { this.pointer = 0; } this.clearHover(); this.btns[this.pointer].className = this.hoverClass; //this.scrollContent.style.top = parseInt(-this.imgHeight * this.pointer) + 'px'; var startVal = parseInt(this.scrollContent.style.left) || 0; var alterVal = (parseInt(-startVal - this.imgHeight * this.pointer)); this.animateIterval && this.animateIterval();//修正快速切换时闪动 this.animateIterval=animate(this.scrollContent, {left : startVal},{left : alterVal}, 1000, Tween.Quad.easeOut); //这里默认设置每张图滚动的总时间是1s }, next: function() { this.invoke(this.pointer + 1); }, last: function(){ if(this.pointer<1){ this.invoke(4); }else{ this.invoke(this.pointer - 1); } }, clearHover: function() { for(var i=0; i