-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
26 lines (24 loc) · 842 Bytes
/
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
let prevScrollpos = window.pageYOffset;
window.onscroll = function() {
let currentScrollPos = window.pageYOffset;
if (prevScrollpos > currentScrollPos) {
document.getElementById("navbar").style.top = "0";
} else {
document.getElementById("navbar").style.top = "-100px";
}
prevScrollpos = currentScrollPos;
}
let projectsDisplay = "none";
function toggleProjects() {
if(projectsDisplay == "none") {
projectsDisplay = "block";
document.getElementById("btn-show").textContent = "Hide";
} else {
projectsDisplay = "none";
document.getElementById("btn-show").textContent = "Show more...";
}
tiles = document.querySelectorAll(".project-tile:nth-child(n+5)");
for(i = 0; i < tiles.length; i++) {
tiles[i].style.display = projectsDisplay;
}
}