umar8902 commited on
Commit
688dab1
·
verified ·
1 Parent(s): 4c5081d

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +6 -7
index.html CHANGED
@@ -8144,24 +8144,23 @@
8144
  function typeEffect() {
8145
  const typingText = document.getElementById("typing-text");
8146
  if (!typingText) return;
8147
-
8148
  const currentWord = words[wordIndex];
8149
-
8150
  if (isDeleting) {
8151
- // FIXED: Show text first, then decrement for next frame
8152
- typingText.textContent = currentWord.substring(0, charIndex);
8153
  charIndex--;
 
8154
  } else {
8155
  typingText.textContent = currentWord.substring(0, charIndex + 1);
8156
  charIndex++;
8157
  }
8158
 
8159
- if (!isDeleting && charIndex >= currentWord.length) {
8160
- // Finished typing — pause before deleting
8161
  isDeleting = true;
8162
  setTimeout(typeEffect, newWordDelay);
8163
  } else if (isDeleting && charIndex < 0) {
8164
- // FIXED: Use < 0 check and reset charIndex to prevent negative drift
8165
  isDeleting = false;
8166
  wordIndex = (wordIndex + 1) % words.length;
8167
  charIndex = 0;
 
8144
  function typeEffect() {
8145
  const typingText = document.getElementById("typing-text");
8146
  if (!typingText) return;
8147
+
8148
  const currentWord = words[wordIndex];
8149
+
8150
  if (isDeleting) {
 
 
8151
  charIndex--;
8152
+ typingText.textContent = currentWord.substring(0, charIndex);
8153
  } else {
8154
  typingText.textContent = currentWord.substring(0, charIndex + 1);
8155
  charIndex++;
8156
  }
8157
 
8158
+ if (!isDeleting && charIndex === currentWord.length) {
8159
+ // Finished typing the word — pause, then start deleting
8160
  isDeleting = true;
8161
  setTimeout(typeEffect, newWordDelay);
8162
  } else if (isDeleting && charIndex < 0) {
8163
+ // Finished deleting move to next word
8164
  isDeleting = false;
8165
  wordIndex = (wordIndex + 1) % words.length;
8166
  charIndex = 0;