高手进来。问题可大了

2016-07-07 16:04 来源:www.chinab4c.com 作者:ecshop专家

;(function(){
var
_noop = function(){},
slider =
window.Slider = function(ops){
this.init(ops || {});
};
slider.prototype = {
c**tructor : slider,
_ops : {
length : 4,
shell : null,
auto : false,
autoStop : true,
cName : 'left',
duration : 200,
unitSize : 500,
delay : 5000,
easing : 'swing',
onplay : _noop,
ondone : _noop,
onbeforeplay : _noop
},
init : function(ops){
var
k,
self = this,
_ops = this._ops;
for(k in _ops){
if(typeof ops[k] === 'undefined'){
ops[k] = _ops[k];
}
}
this.index = 0;
this.ops = ops;
if(ops.auto){
this.autoPlay();
ops.autoStop && ops.shell.hover(function(){
self.stopAuto();
}, function(){
self.autoPlay();
});
}
},
play : function(inx){
inx = parseInt(inx, 10);
inx = isFinite(inx) ? inx : this.index + 1;
var
ani = {},
self = this,
ops = this.ops,
shell = ops.shell,
len = ops.length;
inx = (inx < 0 ? len - 1 : inx) % len;
if(!shell || !shell.animate || inx === this.index || ops.onbeforeplay.call(this, inx, this.index) === false) return this;
ani[ops.cName] = -inx * ops.unitSize;
shell.stop().animate(ani, ops.duration, ops.easing, function(){
ops.ondone.call(self, inx, self.index);
self.index = inx;
});
ops.onplay.call(self, inx, this.index);
return this;
},
next : function(){
return this.play();
},
prev : function(){
return this.play(this.index - 1);
},
autoPlay : function(){
var
self = this;
this._timer = setTimeout(function(){
self.play().autoPlay();
}, this.ops.delay);
},
stopAuto : function(){
window.clearTimeout(this._timer);
}
};
})();




和官方的transport.js有冲突。无限求助

回答:
太好了!!!谢谢分享啊!!!顶顶!!

请问要表达什么意思呢