-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
43 lines (36 loc) · 1.11 KB
/
script.js
File metadata and controls
43 lines (36 loc) · 1.11 KB
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
let allQuotes = [
{
msg: "Stay hungry, stay foolish.",
who: "Steve Jobs"
},
{
msg: "Believe in yourself and all that you are.",
who: "Unknown"
},
{
msg: "Push yourself, because no one else is going to do it for you.",
who: "Unknown"
},
{
msg: "Great things never come from comfort zones.",
who: "Unknown"
},
{
msg: "Dream it. Wish it. Do it.",
who: "Unknown"
}
];
let quoteText = document.getElementById("quote-text");
let quoteWriter = document.getElementById("quote-writer");
let button = document.getElementById("btn");
function getNewQuote() {
let num = Math.floor(Math.random() * allQuotes.length);
let quoteNow = allQuotes[num];
quoteText.textContent = `"${quoteNow.msg}"`;
quoteWriter.textContent = `– ${quoteNow.who}`;
document.querySelector(".box").style.animation = "none";
void document.querySelector(".box").offsetWidth;
document.querySelector(".box").style.animation = "fade 0.5s ease";
}
button.addEventListener("click", getNewQuote);
getNewQuote();