-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
34 lines (28 loc) · 1.11 KB
/
scripts.js
File metadata and controls
34 lines (28 loc) · 1.11 KB
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
function toggleMobileMenu() {
document.getElementById("menu").classList.toggle("active");
}
document.addEventListener("DOMContentLoaded", () => {
const projectArticles = document.querySelectorAll(".jobs article");
projectArticles.forEach((article) => {
// Open project links in a new tab on click
article.addEventListener("click", () => {
const url = article.getAttribute("data-url");
if (url) window.open(url, "_blank");
});
});
});
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", function (event) {
event.preventDefault();
const targetId = this.getAttribute("href");
const targetElement = document.querySelector(targetId);
if (targetElement) {
window.scrollTo({
top: targetElement.offsetTop - 50, // Adjust offset if needed
behavior: "smooth"
});
}
});
});
});