-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
44 lines (42 loc) · 1.7 KB
/
index.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
let logoText = document.getElementById("navbar_Logo")
logoText.addEventListener("mouseover", () => {
logoText.classList.add("hoveredOnLogo");
logoText.innerText = "You Look Good";
});
logoText.addEventListener("mouseleave", () => {
logoText.innerText = "Glossier.";
logoText.classList.remove("hoveredOnLogo");
})
function mobile() {
var x = document.querySelector(".navbarChild_second")
if (x.classList.contains("mobilemenu")) {
x.classList.remove("mobilemenu"); // Remove the class "mobilemenu"
} else {
x.classList.add("mobilemenu"); // Add the class "mobilemenu"
}
}
let isLoggedIn = localStorage.getItem("userName");
let userHello = document.getElementById("userHello")
document.addEventListener("DOMContentLoaded", function() {
var userDropdown = document.getElementById("user-dropdown");
var dropdownContent = document.getElementById("user-dropdown-content");
var loginLink = document.getElementById("login-link");
var signupLink = document.getElementById("signup-link");
var signoutLink = document.getElementById("signout-link");
userDropdown.addEventListener("mouseover", function() {
dropdownContent.style.display = "block";
if (localStorage.getItem("isLoggedIn") === "true") {
loginLink.style.display = "none";
signupLink.style.display = "none";
userHello.innerText = `Hello, ${isLoggedIn}`
signoutLink.style.display = "block";
} else {
loginLink.style.display = "block";
signupLink.style.display = "block";
signoutLink.style.display = "none";
}
});
userDropdown.addEventListener("mouseout", function() {
dropdownContent.style.display = "none";
});
});