Fading in/out a jquery list

后端 未结 5 350
误落风尘
误落风尘 2021-01-27 23:12

I\'m trying to write a jquery function that loops through an unordered list (the ul element having the id \"intro\") and individually fades in and fades out each element. This

5条回答
  •  一生所求
    2021-01-28 00:09

    Try

    function startAnimations() {
        $("#intro li").hide();
    
        function loop() {
            var $li = $("#intro li:first-child").fadeIn(3000, function () {
                $li.fadeOut(3000, function () {
                    $li.appendTo('#intro');;
                    loop()
                })
            });
        }
        loop()
    }
    

    Demo: Fiddle

提交回复
热议问题