Simple typing results

const DOM = document.querySelector ( ' .content ' )
 const Data = ' easiest typing effect of the code ' .split ( '' ) 
    the let index = 0 
    function Writing (index) { 
        IF (index < data.length) { 
            DOM. the innerHTML + = Data [index] 
            the setTimeout (writing.bind ( the this ), 200 is , ++ index) 
        } 
    }

 

Plus simulated blinking cursor after the word:

::after{
    content: '|';
    animation: blink 1s infinite
}
@keyframes blink{
    from{
        opacity: 0;
    }
    to{
        opacity: 1;
    }
}

 

Guess you like

Origin www.cnblogs.com/xiaolucky/p/11971798.html