From 01540bb3e7cbc21ea732a78e9156ba2eaaa0c3ba Mon Sep 17 00:00:00 2001 From: kavyan Date: Mon, 27 Mar 2017 22:53:01 -0700 Subject: [PATCH 1/2] Rectified bugs in js Scroll --- index.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index b3625db..2df87d6 100644 --- a/index.html +++ b/index.html @@ -30,11 +30,17 @@ word_counter = 0, character_counter = 0; + console.log(words[4].length); + function updateText() { - el.innerHTML = el.innerHTML+words[word_counter][character_counter++]; + var char = words[word_counter][character_counter++] + if (char == " " ) { + char = " " + } + el.innerHTML += char; - if(character_counter == words[word_counter].length) + if(character_counter > words[word_counter].length) { word_counter++; //choose a different word character_counter = 0; //start over with the first character of the word @@ -46,10 +52,10 @@ } } - setInterval(updateText,300); + setInterval(updateText,1000); - \ No newline at end of file + From c5a8ff41ebdfada87443c39a1aed5ac24762b8f3 Mon Sep 17 00:00:00 2001 From: kavyan Date: Mon, 27 Mar 2017 22:58:22 -0700 Subject: [PATCH 2/2] Rectified bugs and changed back the interval --- index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.html b/index.html index 2df87d6..2ae1876 100644 --- a/index.html +++ b/index.html @@ -30,7 +30,6 @@ word_counter = 0, character_counter = 0; - console.log(words[4].length); function updateText() { @@ -52,7 +51,7 @@ } } - setInterval(updateText,1000); + setInterval(updateText,300);