-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
28 lines (22 loc) · 827 Bytes
/
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
"use strict";
const header = document.querySelector("header");
const navbar = document.querySelector("nav");
const subNavDrop = document.querySelector(".subnav .dropdown");
const subDropBtn = document.querySelector(".subnav .dropbtn");
const subNavContent = document.querySelector(".subnav .dropdown-content");
const landingRoadmapBtn = document.querySelector(".button_roadmap");
// Sticky Navbar
window.addEventListener("scroll", function () {
if (window.scrollY > header.offsetHeight + 50) {
navbar.classList.add("nav-scroll");
} else {
navbar.classList.remove("nav-scroll");
}
});
// Subnavigation menu
subDropBtn.addEventListener("click", function () {
subNavContent.classList.toggle("show");
});
landingRoadmapBtn.addEventListener("click", function () {
subNavContent.classList.toggle("show");
});