So, I was reading a post earlier about how to implement the typewriter effect into my site, however, I believe it is different from what I am actually trying to accomplish. I was wondering, how would I utilize the effect, for JUST my name on the home page of my portfolio site? I want it to type out something, then backspace, then type out my name. I have ZERO coding knowledge. Just trying to avoid having my brain explode, as that is no fun.
I tried it out. The only problem is that I keep getting “unlined” at the end of my text. Also, I have no idea how to change the font size and it keeps adding duplicates anytime the home button is click, instead of restarting message.
@universaliceman Sorry about the duplicates. I thought I was just putting together a “quick and dirty” example, but I should’ve known better. Hopefully I fixed it.
What do you mean by “unlined” at the end of the text. It works OK for me. What happens?
there is a undefined at the end which is showing up along with the text. Also, can you set it in such a way that this animation gets repeated again and again after 5 seconds intervals?
let i = 0, interval = 100, delay = 5000;//change the delay if you want
const text = "My text is here. Yes, it's here.";
const words = text.split(' ');
const runTyping = (ms) => setTimeout(() => showText(), ms);
function showText(){
$w("#text1").text = words.slice(0, i).join(' ');
i = (i + 1) % (words.length + 1);
i > 0 ? runTyping(interval) : runTyping(delay);
}
$w.onReady(() => runTyping(interval));
i would want every word letter by letter, just for several words. so the word “hello” gets typed out, gets cleared and then the word “world” gets typed out, then disappears to be followed by “foo”, etc . I know it will require an array of words that a loop is going through.