-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathscript.js
41 lines (37 loc) · 1.17 KB
/
script.js
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
30
31
32
33
34
35
36
37
38
39
40
41
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);
});
// Function to show sidebar menu.
function showSidebar(){
const sidebar = document.querySelector(".sidebar");
sidebar.style.display = 'flex'
}
// Function to hide the side menu.
function hideSidebar(){
const sidebar = document.querySelector(".sidebar");
sidebar.style.display = 'none'
}