-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnav.js
More file actions
30 lines (25 loc) · 1.1 KB
/
nav.js
File metadata and controls
30 lines (25 loc) · 1.1 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
import { randomProjectsArr } from "./random-project-links-array.js";
const homeMenuIcon = document.querySelector(".ham-menu");
const navList = document.querySelector("nav ul");
const randomProjectEl = document.querySelector(
".navigation nav ul li:last-child a"
);
homeMenuIcon.addEventListener("click", () => {
navList.classList.toggle("hide-ul");
});
/**********************************************************************************************************************/
// For any change here a manual change is required for projects 3, 25, 38, 45;
if (location.hostname === "127.0.0.1") {
randomProjectEl.href = `/${
randomProjectsArr[Math.floor(Math.random() * randomProjectsArr.length)]
}`;
} else if (location.href.split("/").length < 6) {
randomProjectEl.href = `./${
randomProjectsArr[Math.floor(Math.random() * randomProjectsArr.length)]
}`;
} else {
randomProjectEl.href = `../${
randomProjectsArr[Math.floor(Math.random() * randomProjectsArr.length)]
}`;
}
/**********************************************************************************************************************/