From f3da4a7435331f2a0735057df2a861727fabf4a7 Mon Sep 17 00:00:00 2001 From: joneskj55 Date: Wed, 7 Oct 2020 15:26:38 -0500 Subject: [PATCH] add type writer effect to header --- index.html | 2 +- scripts/main.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 485ae70..7ca01be 100644 --- a/index.html +++ b/index.html @@ -72,7 +72,7 @@
-

I will be accepting up to one pull request per day on this project

+

diff --git a/scripts/main.js b/scripts/main.js index d37aa23..740339c 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -39,3 +39,20 @@ document.getElementById('sidebar-toggle').style.display = 'block'; })(); + +//---TYPEWRITER EFFECT---// +let i = 0; +let txt = 'I will be accepting up to one pull request per day on this project'; +let speed = 60; + +function typeWriter() { + if (i < txt.length) { + document.getElementById("header").innerHTML += txt.charAt(i); + i++; + setTimeout(typeWriter, speed); + } +} + +window.onload = function () { + typeWriter(); +};