-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.js
33 lines (29 loc) · 833 Bytes
/
common.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
function toggleNavOpen() {
document.querySelector("nav").classList.toggle("nav--open");
}
function toggleNavClose() {
document.querySelector("nav").classList.toggle("nav--open");
}
document.onkeydown = function(e) {
if (e.ctrlKey &&
(e.keyCode === 67 ||
e.keyCode === 86 ||
e.keyCode === 85 ||
e.keyCode === 117)) {
//alert('not allowed');
return false;
}
else {
return true;
}
};
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
if (prevScrollpos > currentScrollPos) {
document.getElementById("navbar").style.top = "0";
} else {
document.getElementById("navbar").style.top = "-155px";
}
prevScrollpos = currentScrollPos;
}