从无到右,从有到无的效果

从无到右,从有到无的效果

$("#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);
} 

 

posted @ 2017-12-13 12:14  米娜-火箭  阅读(119)  评论(0编辑  收藏  举报