2024-06-26 04:56:54 -05:00
|
|
|
function typeWriter(elem, delay) {
|
|
|
|
var elemText = elem.text().split('')
|
|
|
|
elem.text('_'.repeat(elemText.length))
|
|
|
|
var i = 0
|
|
|
|
function nextLetter() {
|
|
|
|
elem.text(elemText.slice(0, i).join('') + '_'.repeat(elemText.length - i))
|
|
|
|
if (i < elemText.length) {
|
|
|
|
setTimeout(() => {
|
|
|
|
i++
|
|
|
|
nextLetter()
|
|
|
|
}, 20)
|
|
|
|
}
|
|
|
|
}
|
2024-06-26 05:12:31 -05:00
|
|
|
setTimeout(() => {
|
|
|
|
if (elem.text() == '_'.repeat(elemText.length)) {
|
|
|
|
nextLetter()
|
|
|
|
}
|
|
|
|
}, delay);
|
2024-06-26 04:56:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
|
var i = 0
|
|
|
|
var arr = $("span").each((_, item) => {
|
|
|
|
if ($(item).text().length > 0) {
|
|
|
|
i++
|
|
|
|
typeWriter($(item), i * 450)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|