-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
39 lines (34 loc) · 912 Bytes
/
index.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
document.addEventListener('DOMContentLoaded', () => {
getQuote();
window.addEventListener('scroll', () => {
let currentY = window.pageYOffset;
if(currentY >= 420){
document.getElementById('about').style.opacity = 1;
}
if(currentY >= 1050){
document.getElementById('quote-div').style.opacity = 1;
}
})
});
function getQuote() {
let block = document.querySelector('.zitat1');
fetch('https://api.adviceslip.com/advice')
.then(res => res.json())
.then(data => {
block.innerHTML = `
${data.slip.advice}
<cite>Anonymous</cite>
`
});
}
function getLogin(){
fetch('http://localhost:3000/users')
.then(res => res.json())
.then(data =>{
data.forEach(user => {
if(user.isLoggedIn){
console.log(user);
}
})
})
}