我需要将幻灯片效果替换 为 上一张和下一张幻灯片功能的淡出/淡入效果:
function animate(dir,clicked){
u = true;
switch(dir){
case 'next':
t = t+1;
m = (-(t*w-w));
current(t);
if(o.autoHeight){autoHeight(t);}
if(s<3){
if (t===3){$(o.slides,obj).children(':eq(0)').css({left:(s*w)});}
if (t===2){$(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:(w)});}
}
$(o.slides,obj).animate({left: m}, o.slidespeed,function(){
if (t===s+1) {
t = 1;
$(o.slides,obj).css({left:0},function(){$(o.slides,obj).animate({left:m})});
$(o.slides,obj).children(':eq(0)').css({left: 0});
$(o.slides,obj).children(':eq('+(s-1)+')').css({ position:'absolute',left:-w});
}
if (t===s) $(o.slides,obj).children(':eq(0)').css({left:(s*w)});
if (t===s-1) $(o.slides,obj).children(':eq('+(s-1)+')').css({left:s*w-w});
u = false;
});
break;
case 'prev':
t = t-1;
m = (-(t*w-w));
current(t);
if(o.autoHeight){autoHeight(t);}
if (s<3){
if(t===0){$(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:(-w)});}
if(t===1){$(o.slides,obj).children(':eq(0)').css({position:'absolute',left:0});}
}
$(o.slides,obj).animate({left: m}, o.slidespeed,function(){
if (t===0) {
t = s;
$(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:(s*w-w)});
$(o.slides,obj).css({left: -(s*w-w)});
$(o.slides,obj).children(':eq(0)').css({left:(s*w)});
}
if (t===2 ) $(o.slides,obj).children(':eq(0)').css({position:'absolute',left:0});
if (t===1) $(o.slides,obj).children(':eq('+ (s-1) +')').css({position:'absolute',left:-w});
u = false;
});
break;
case 'fade':
t = [t]*1;
m = (-(t*w-w));
current(t);
if(o.autoHeight){autoHeight(t);}
$(o.slides,obj).children().fadeOut(o.fadespeed, function(){
$(o.slides,obj).css({left: m});
$(o.slides,obj).children(':eq('+(s-1)+')').css({left:s*w-w});
$(o.slides,obj).children(':eq(0)').css({left:0});
if(t===s){$(o.slides,obj).children(':eq(0)').css({left:(s*w)});}
if(t===1){$(o.slides,obj).children(':eq('+(s-1)+')').css({ position:'absolute',left:-w});}
$(o.slides,obj).children().fadeIn(o.fadespeed);
u = false;
});
break;
default:
break;
}
};
我试过了,但自动重启不起作用!
您可以在此链接中查看文档并下载包含示例的完整代码:http: //github.com/nathansearles/loopedSlider/tree/master
请帮我! (对不起,我的英语不好!)