Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions DanielB/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
js_scroll
=========

Exercise for the CodingDojo's Javascript course. See the learning platform to see how you should improve the codes. There are several bugs with the codes which are intentional. :)
66 changes: 66 additions & 0 deletions DanielB/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<html>
<head>
<title>Javascript Demo</title>
<style>
body {
background-color:black;
font-family: monospace;
color:white;
font-size:50px;
text-align: center;
margin-top:20%;
}

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

Coding is <div id="magic"></div>

<script>

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

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

} else {

el.innerHTML = el.innerHTML+words[word_counter][character_counter++];

if(character_counter == words[word_counter].length)
{
temp=word_counter;
word_counter= Math.floor(Math.random()*words.length); //choose a different word
character_counter = 0; //start over with the first character of the word
el.innerHTML = ''; //set the html to be blank

while(temp==word_counter)
word_counter= Math.floor(Math.random()*words.length);

// //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>
3 changes: 0 additions & 3 deletions README.md

This file was deleted.