-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
59 lines (50 loc) · 1.58 KB
/
app.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
const anchors = document.querySelectorAll('li a');
const buttons = document.querySelectorAll('.post');
const gmail = document.querySelector('.gmail');
const linkedin = document.querySelector('.linkedin');
const github = document.querySelector('.github');
const collapseButtons = document.querySelectorAll('.collapsible');
anchors.forEach(a => {
a.addEventListener('click', e => {
e.preventDefault();
document.querySelector(a.getAttribute("href")).scrollIntoView({
behavior: "smooth"
});
});
});
buttons.forEach(button => {
button.addEventListener('click', (e) => {
let content = e.target.nextElementSibling;
let text = content.firstElementChild;
text.style.padding = "30px";
text.style.marginTop = "0px";
if (content.style.maxHeight) {
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
});
gmail.addEventListener('mouseover', e => {
e.target.lastElementChild.style.color = "#e04b43";
})
gmail.addEventListener('mouseout', e => {
e.target.lastElementChild.style.color = "";
})
linkedin.addEventListener('mouseover', e => {
e.target.lastElementChild.style.color = "#0072B1";
})
linkedin.addEventListener('mouseout', e => {
e.target.lastElementChild.style.color = "";
})
github.addEventListener('mouseover', e => {
e.target.lastElementChild.style.color = "#3fb64f";
})
github.addEventListener('mouseout', e => {
e.target.lastElementChild.style.color = "";
})
collapseButtons.forEach(button => {
button.addEventListener('click', e => {
e.target.classList.toggle("active");
})
});