document.addEventListener("DOMContentLoaded", () => { const text = "برای ورود به کانال بله کلیک کنید"; const el = document.querySelector(".typing-text");
let charIndex = 0; let isTyping = true;
const typingSpeed = 120; const delayBeforeClear = 1200;
function manageTextAnimation() { if (isTyping) {
if (charIndex < text.length) { el.textContent = text.substring(0, charIndex + 1); charIndex++; setTimeout(manageTextAnimation, typingSpeed); } else { isTyping = false; setTimeout(manageTextAnimation, delayBeforeClear); } } else { el.textContent = ""; charIndex = 0; isTyping = true; setTimeout(manageTextAnimation, 0); } } manageTextAnimation(); });
پشتیبانی وبسایت