jQuery Animation, Chaining, .each() and .animate() (or fadeIn() and fadeOut())

前端 未结 4 1125
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 15:20

I\'m having a bit of a trouble trying to figure this out today, i want to make 5 items inside my DOM (which is listed under the same attribute element, $(\'.elements\')) fade in

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 15:30

    Beautiful way :

    (function hideNext(jq){
            jq.eq(0).hide("slow", function(){
                (jq=jq.slice(1)).length && hideNext(jq);
            });
    
    })($('a'))
    

    last first :

    (function hideNext(jq){
                    jq.eq(jq.length-1).hide("slow", function(){
                        (jq=jq.slice(0,length-1)).length && hideNext(jq);
                    });
    
    })($('a'))
    

提交回复
热议问题