Native digital scrolling effect, H5

<! DOCTYPE HTML> 
<HTML> 
<head> 
    <Meta charset = " UTF-. 8 " > 
    <title> </ title> 
</ head> 
<body> 
<h1 of ID = " NUM " > </ h1 of> 
</ body > 
<Script type = " text / JavaScript " >
     var numBox = document.getElementById ( ' NUM ' );
     / * * 
     * through the numbers 
     * @param {Object} num start value 
     * {Object} maxNum maximum @param, showing the final value 
     * / 
    function numRunFun (NUM,maxNum) { 
        were numText =NUM;
         var Golb; // To remove requestAnimationFrame 
        function numSlideFun () { 
            numText + = 10000 ; // calculation speed may be fractional 
            IF (numText> = maxNum) { 
                numText = maxNum; 
                cancelAnimationFrame (Golb); 
            } the else { 
                Golb = requestAnimationFrame (numSlideFun); 
            } 
            numBox.innerHTML = ~ ~ (numText) 

        } 
        numSlideFun (); 
    } 
    // run
    numRunFun(0,99000)
</script>
</html>

 

Guess you like

Origin www.cnblogs.com/baixiaoxiao/p/11243083.html