When JS doesn't scroll at first, it takes a few seconds to scroll.

I want to show as soon as I start scrolling. Don"t wait a few seconds to display the value of
.
ask for advice

<script>
 
$(function(){
    var scrollDiv = $(".scroll"),
        $ul = scrollDiv.find("ul"),
        $li = scrollDiv.find("li"),
        $length = $li.length,
        $liHeight = $li.height(),
        num = 2;
 
    if(scrollDiv.length == 0){
        return;
    }
 
    if($length > 1){
        $ul.append($li.eq(0).clone());
      
        setInterval(
            function(){
                numPP;
                $ul.addClass("animate").css("-webkit-transform","translateY(-"+ $liHeight*(num) +"px)");
                setTimeout(
                    function(){
                        if(num == $length){
                            $ul.removeClass("animate").css("-webkit-transform","translateY(-70px)");
                            num = 2;
                        }
                    },3000);
            },3000);
    }
});
</script>
Mar.03,2021

all the timer does is PP; the variable num

if($length > 1){
        $ul.append($li.eq(0).clone());
      
        setInterval(
            function(){
                numPP;
                $ul.addClass("animate").css("-webkit-transform","translateY(-"+ $liHeight*(num) +"px)");
                setTimeout(
                    function(){
                        if(num == $length){
                            $ul.removeClass("animate").css("-webkit-transform","translateY(-70px)");
                            num = 2;
                        }
                    },1000);
            },1000);
    }

you can change 3000 to 1000, so it will be faster

Menu