-
Notifications
You must be signed in to change notification settings - Fork 0
/
function.js
76 lines (47 loc) · 2.88 KB
/
function.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const texts = [
"We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light - Plato ",
"Computer programs are the most complex things that humans make. ― Douglas C., JavaScript: The Good Parts ",
"There is no coming to consciousness without pain. -Carl Jung ",
"Sometimes people don't want to hear the truth because they don't want their illusions destroyed. -Nietzche ",
"Be alone, that is the secret of invention; be alone, that is when ideas are born. -Tesla ",
"I never did anything worth doing by accident, nor did any any of my inventions come by accident; they came by work. -Plato ",
"It is during our darkest moments that we must focus to see the light. - Aristotle ",
"There is one kind of robber whom the law does not strike at, and who steals what is most precious to men: time. -Napoleon ",
" Our life is made by the death of others - Leonardo da Vinci ",
"I do not think there is any thrill that can go through the human heart like that felt by the inventor as he sees some creation of his brain unfolding to success -Tesla ",
"God is not willing to do everything, and thus take away our free will and that share of glory which belongs to us – Niccolo Machiavelli ",
"The unexamined life is not worth living – Socrates ",
"Good character is not formed in a week or a month. It is created little by little, day by day. Protracted and patient effort is needed. - Heraclitus ",
];
let count = Math.floor(Math.random() *12);
let index = 0;
let currentText = "";
let letter = "";
(function type(){
if (count === texts.length || count > texts.length){
count = 0;
}
currentText =texts[count];
letter = currentText.slice(0,++index);
document.querySelector(".typing").textContent = letter;
if(letter.length === currentText.length){
count += Math.floor(Math.random() *4)+1;
index = 0;
}
setTimeout(type,90);
})();
//index page background opacity
let major = document.getElementById('majorback');
let major2 = document.getElementById('navbackindex');
document.getElementById('backgroundindex').onclick=function(){
major.classList.toggle('disappear');
major2.classList.toggle('disappear');
};
//about page backgroundindex
let major3 = document.getElementById('aboutport');
let major4 = document.getElementById('aboutinfo123');
document.getElementById('abouthehe').onclick=function(){
major3.classList.toggle('disappear');
navbarabout.classList.toggle('disappear');
major4.classList.toggle('disappear');
}