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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a479-2c20a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a479-2c20a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?