-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
40 lines (37 loc) · 1.19 KB
/
main.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
window.addEventListener('resize', function(){
"use strict";
window.location.reload();
});
if (window.matchMedia("(min-width: 894px)").matches) {
window.onscroll = function() {
scrollFunction();
growShrinkLogo();
};
function scrollFunction() {
if (
document.body.scrollTop > 40 ||
document.documentElement.scrollTop > 40
) {
document.getElementById("navbar").style.background = "#000";
document.getElementById("navbar").style.transition = "0.3s ease-in-out";
} else {
document.getElementById("navbar").style.background = "transparent";
}
}
function growShrinkLogo() {
var Logo = document.getElementById("logo");
if (document.body.scrollTop > 5 || document.documentElement.scrollTop > 5) {
Logo.style.height = "45px";
Logo.style.transition = "0.3s ease-in-out";
Logo.style.paddingTop = "6px";
} else {
Logo.style.height = "66px";
}
}
} else {
let mainNav = document.getElementById("js-menu");
let navBarToggle = document.getElementById("js-navbar-toggle");
navBarToggle.addEventListener("click", function() {
mainNav.classList.toggle("active");
});
}