Load List Items dynamically with JQuery

后端 未结 6 1820
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 13:58

I\'d like to structure my JQuery to fade in each individual item at a time. Here\'s an example of the behavior, and here\'s the JQuery I have so far:

$(\'li\         


        
6条回答
  •  一生所求
    2021-01-14 14:28

    A slight variation on Ivans method

    $(function() {
        $('ul li:hidden').each(function(idx) {
            setTimeout(function(el) {
                el.fadeIn();
            }, idx* 1000, $(this));
        });
    });
    

    And a recursive function using fadeIn callback function instead of setTimeout

    function DisplayOneByOne(){
        $('ul li:hidden:first').fadeIn('2000',  DisplayOneByOne);
    }
    

提交回复
热议问题