var rand = Math.floor(Math.random()*2);
oLi.eq(nextIndex).show();
oLi.eq(nextIndex).css("z-index","-1");
if (rand) {
//向左滑动
oLi.eq(prevIndex).animate({left: -liWidth},1000,fun);
}
else{
oLi.eq(prevIndex).animate({left: liWidth},1000,fun);
}
function fun(){
oLi.eq(prevIndex).css({"left":"0","display":"none"});
oLi.eq(nextIndex).css("z-index","1");
}
}
//收缩效果
function grap(prevIndex,nextIndex){
var rand = Math.floor(Math.random()*4);
oLi.eq(nextIndex).show();
oLi.eq(nextIndex).css("z-index","-1");
switch (rand){
case 0://向左上角滑动
oLi.eq(prevIndex).animate({left: -liWidth,top: -liHeight},1000,function(){
oLi.eq(prevIndex).css({"left":"0","top": "0","display":"none"});
oLi.eq(nextIndex).css("z-index","1");
});break;
case 1://向右上角滑动
oLi.eq(prevIndex).animate({left: liWidth,top: -liHeight},1000,function(){
oLi.eq(prevIndex).css({"left":'0',"top":"0","display":"none"});
oLi.eq(nextIndex).css("z-index","1");
});break;
case 2://向右下角滑动
oLi.eq(prevIndex).animate({left: liWidth,top: liHeight},1000,function(){
oLi.eq(prevIndex).css({"left":'0',"top":"0","display":"none"});
oLi.eq(nextIndex).css("z-index","1");
});break;
case 3://向左下角滑动
oLi.eq(prevIndex).animate({left: -liWidth,top: liHeight},1000,function(){
oLi.eq(prevIndex).css({"left":'0',"top":"0","display":"none"});
oLi.eq(nextIndex).css("z-index","1");
});break;
default:break;
}
}
});
</script>
</body>
</html>
更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery图片操作技巧大全》、《jQuery切换特效与技巧总结》、《jQuery拖拽特效与技巧总结》、《jQuery扩展技巧总结》、《jQuery常见经典特效汇总》、《jquery选择器用法总结》及《jQuery常用插件及用法总结》
希望本文所述对大家jQuery程序设计有所帮助。










