-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
32 lines (27 loc) · 830 Bytes
/
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
//JQuery
const right = $(".right");
const left = $(".left");
right.hover(
() => {
$(".container").addClass("hover-right");
},
() => {
$(".container").removeClass("hover-right");
}
);
left.hover(
() => {
$(".container").addClass("hover-left");
},
() => {
$(".container").removeClass("hover-left");
}
);
//Vanilla JS
const lefts = document.querySelector(".left")
const rights = document.querySelector(".right")
const container = document.querySelector(".container")
lefts.addEventListener("mouseenter", () => container.classList.add("hover-left"))
lefts.addEventListener("mouseleave", () => container.classList.remove("hover-left"))
rights.addEventListener("mouseenter", () => container.classList.add("hover-right"))
rights.addEventListener("mouseleave", () => container.classList.remove("hover-right"))