I want to delay this typing effect after the page loads instead of starting in immediately, how could I do this?
document.addEventListener ('DOMContentLoaded',function(event) {
var dataText = ["This is a typing effect"];
function typeWriter(text, i, fnCallback) {
if (i < (text.length)) {
document.querySelector("h1").innerHTML = text.substring(0, i+1) +'<span aria-hidden="true"></span>';
setTimeout(function() {
typeWriter(text, i + 1, fnCallback)
}, 75);
}
else if (typeof fnCallback == 'function') {
}
}
function StartTextAnimation(i) {
if (typeof dataText[i] == 'undefined'){
setTimeout(function() {
StartTextAnimation(0);
}, 20000);
}
if (i < dataText[i].length) {
typeWriter(dataText[i], 0, function(){
StartTextAnimation(i + 1);
});
}
}
StartTextAnimation(0);
});
, 75(which is a delay of only 75 milliseconds) to a larger value (1 second = 1000 milliseconds).