-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.js
36 lines (29 loc) · 931 Bytes
/
common.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
"use strict";
/* TO DO LIST
*Fix slider for tablet 1080px viewport/smaller viewport
*/
// Navigation
const nav = document.querySelector(".nav");
const btnBookOnline = document.querySelector(".book-online");
const headerLogo = document.querySelector(".header-logo");
function navBarAction() {
const x = document.getElementById("topNav");
if (x.className === "nav") {
x.className += " responsive";
headerLogo.className += " responsive";
} else {
x.className = "nav";
headerLogo.className = "header-logo";
}
}
const handleHover = function (e) {
if (e.target.classList.contains("nav__link")) {
const link = e.target;
const siblings = link.closest(".nav").querySelectorAll(".nav__link");
siblings.forEach((el) => {
if (el !== link) el.style.opacity = this;
});
}
};
nav.addEventListener("mouseover", handleHover.bind(0.5));
nav.addEventListener("mouseout", handleHover.bind(1));