从无到右,从有到无的效果
$("#ul").css('opacity',0); changeOpacity(); //从无到有,2s;等待3s;从有到无,2s;等待1s;循环; function changeOpacity() { var waitTime=1000; $("#ul").fadeTo(2000,opacityUl); if(opacityUl==1){ opacityUl=0; waitTime=3000; }else if(opacityUl==0){ opacityUl=1; waitTime=3000; } setTimeout(changeOpacity, waitTime); }