Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.html #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
text-align: center;
margin-top:20%;
}

#magic{
color: #777;
border-right: 1px solid #777;
Expand All @@ -24,32 +23,30 @@
Coding is <div id="magic"></div>

<script>

var words = ["fun", "exciting", "about not giving up", "being helpful", "being open", "what I learned at CodingDojo!"],
el = document.getElementById('magic'),
word_counter = 0,
character_counter = 0;

function updateText()
{
el.innerHTML = el.innerHTML+words[word_counter][character_counter++];

if(character_counter == words[word_counter].length)
var character = words[word_counter][character_counter++];
if(character==" "){
character = "&nbsp";
}
el.innerHTML += character;
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
el.innerHTML = ''; //set the html to be blank

//if we're displaying the last word, go back to the first word
if(word_counter == words.length)
word_counter = 0;
}
}

setInterval(updateText,300);

</script>

</body>

</html>
</html>