Onscreen text-typing effect
Thu Oct 05 2023 16:07:22 GMT+0000 (Coordinated Universal Time)
Saved by
@destinyChuck
#javascript
function runTypingEffect() {
const text = 'I am Chuck Winters.';
const typingElement = document.getElementById('typing-text');
const typingDelay = 100;
typeText(text, typingElement, typingDelay);
}
function typeText(text, typingElement, typingDelay) {
for (let i = 0; i < text.length; i++) {
setTimeout(() => {
typingElement.textContent += text.charAt(i);
}, typingDelay * i);
}
}
document.addEventListener('DOMContentLoaded', runTypingEffect)
content_copyCOPY
Comments