Fix typewriter against secondary print sections

This commit is contained in:
Tyler Perkins 2023-07-30 18:48:53 -04:00
parent b1e5a1f359
commit e479f21fe9
2 changed files with 9 additions and 2 deletions

View File

@ -1,7 +1,10 @@
{{ define "main" }} {{ define "main" }}
<div class="centered top-fade"> <div class="centered top-fade">
<div class="intro-content"> <div class="intro-content">
{{ .Content }} <h1 data-value="Hi, I'm Tyler" data-show="intro-tagline" class="typewriter"></h1>
<div id="intro-tagline">
<p data-value="Software engineer, postmath"></p>
</div>
</div> </div>
</div> </div>
<div class="homepage-card"> <div class="homepage-card">
@ -22,6 +25,7 @@
</div> </div>
</div> </div>
</div> </div>
<!--
<div class="homepage-card"> <div class="homepage-card">
<h1 to-show="about-description" data-value="uname -a" class="typewriter">~ $&nbsp;</h1> <h1 to-show="about-description" data-value="uname -a" class="typewriter">~ $&nbsp;</h1>
<div class="about-grid"> <div class="about-grid">
@ -38,4 +42,5 @@
</div> </div>
</div> </div>
</div> </div>
-->
{{ end }} {{ end }}

View File

@ -82,10 +82,12 @@ async function typeWriter(element) {
let hiddenElementText = p.getAttribute("data-value"); let hiddenElementText = p.getAttribute("data-value");
//hiddenElementText = replaceSpacesWithNbsp(hiddenElementText); //hiddenElementText = replaceSpacesWithNbsp(hiddenElementText);
p.innerHtml = ""; p.innerHtml = "";
output = "";
for (let i = 0; i < hiddenElementText.length; ++i){ for (let i = 0; i < hiddenElementText.length; ++i){
p.innerText += hiddenElementText.charAt(i); output += hiddenElementText.charAt(i);
await sleep(hiddenElementSpeed); await sleep(hiddenElementSpeed);
p.innerText = output;
} }
await sleep(50); await sleep(50);