forked from avanimathur/Student-ify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (27 loc) · 887 Bytes
/
script.js
File metadata and controls
29 lines (27 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
document.addEventListener("DOMContentLoaded", function(event) {
document.querySelector(".Hi").classList.add("loaded");
});
document.addEventListener("DOMContentLoaded", function() {
var paragraphs = document.querySelectorAll('#content p');
var currentParagraph = 0;
var currentWord = 0;
var words;
var intervalId = setInterval(function() {
if (currentParagraph >= paragraphs.length) {
clearInterval(intervalId);
return;
}
if (!words) {
words = paragraphs[currentParagraph].textContent.split(' ');
paragraphs[currentParagraph].textContent = '';
}
if (currentWord < words.length) {
paragraphs[currentParagraph].textContent += words[currentWord] + ' ';
currentWord++;
} else {
currentWord = 0;
currentParagraph++;
words = null;
}
}, 100);
});