-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
55 lines (47 loc) · 1.73 KB
/
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
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
// Sticky Navigation Menu
let nav = document.querySelector("nav");
let scrollBtn = document.querySelector(".scroll-button a");
// Show/hide sticky navigation and scroll button based on scroll position
window.onscroll = function () {
if (document.documentElement.scrollTop > 20) {
nav.classList.add("sticky");
scrollBtn.style.display = "block";
} else {
nav.classList.remove("sticky");
scrollBtn.style.display = "none";
}
};
// Side Navigation Menu
let body = document.querySelector("body");
let navBar = document.querySelector(".navbar");
let menuBtn = document.querySelector(".menu-btn");
let cancelBtn = document.querySelector(".cancel-btn");
// Open side navigation
menuBtn.onclick = function () {
navBar.classList.add("active");
menuBtn.style.opacity = "0";
menuBtn.style.pointerEvents = "none";
body.style.overflow = "hidden";
scrollBtn.style.pointerEvents = "none";
};
const hideNavMenu = () => {
navBar.classList.remove("active");
menuBtn.style.opacity = "1";
menuBtn.style.pointerEvents = "auto";
body.style.overflow = "auto";
scrollBtn.style.pointerEvents = "auto";
};
// Close side navigation
cancelBtn.onclick = hideNavMenu;
// Close side navigation when a menu link is clicked
let navLinks = document.querySelectorAll(".menu li a");
navLinks.forEach((link) => {
link.addEventListener("click", hideNavMenu);
});
// Attatch Resume file
document.getElementById('download-btn').addEventListener('click', function () {
const link = document.createElement('a');
link.href = 'https://drive.google.com/file/d/1XyXNhzJR6sfd70ViyZHK8f7jRNBMjFPb/view?usp=sharing';
link.target = '_blank';
link.click();
});