This commit is contained in:
2025-02-25 20:59:11 +08:00
parent 46d9f195b1
commit 0263d8a436
8 changed files with 99 additions and 40 deletions

View File

@@ -85,26 +85,19 @@
const text = "Take Control of Your AI Future";
const textElement = document.getElementById("typing-text");
let loopCount = 0;
const maxLoops = 5;
const maxLoops = 1;
function typeText(i, callback) {
if (i < text.length) {
textElement.textContent += text.charAt(i);
setTimeout(() => typeText(i + 1, callback), 100);
setTimeout(() => typeText(i + 1), 100);
} else {
setTimeout(callback, 1000);
setTimeout(callback, 2000);
}
}
function deleteText(callback) {
let currentText = textElement.textContent;
if (currentText.length > 0) {
textElement.textContent = currentText.substring(0, currentText.length - 1);
setTimeout(() => deleteText(callback), 50);
} else {
setTimeout(callback, 100);
}
}
function loopTyping() {
if (loopCount < maxLoops) {