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

Bugs fixed. #52

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
64 changes: 34 additions & 30 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,55 +1,59 @@
<html>

<head>
<title>Javascript Demo</title>
<style>
body {
background-color:black;
background-color: black;
font-family: monospace;
color:white;
font-size:50px;
color: white;
font-size: 50px;
text-align: center;
margin-top:20%;
margin-top: 20%;
}

#magic{
#magic {
color: #777;
border-right: 1px solid #777;
padding-right: 7px;
display: inline;
}
</style>
</head>

<body>

Coding is <div id="magic"></div>
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)
{
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;
(function() {
var words = ["fun time", "exciting", "about not giving up", "being helpful", "being open", "what I learned at CodingDojo!"];
var el = document.getElementById('magic');
var word_counter = 0;
var character_counter = 0;

function updateText() {

if (words[word_counter][character_counter] == " ")
el.innerHTML += "&nbsp;"
else
el.innerHTML += words[word_counter][character_counter];

if (++character_counter == words[word_counter].length + 1) {
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);

setInterval(updateText, 300);
}());
</script>

</body>

</html>
</html>