-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
38 lines (34 loc) · 1.01 KB
/
Copy pathscript.js
File metadata and controls
38 lines (34 loc) · 1.01 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
35
36
37
38
const apps = document.querySelectorAll(".app");
const length = apps.length;
apps.forEach((item, index) => {
item.addEventListener("mouseover", () => {
// Resize the hovered app
apps[index].style.height = '150px';
apps[index].style.width = '150px';
// Resize the neighboring apps
if (index > 0) {
apps[index - 1].style.height = '125px';
apps[index - 1].style.width = '125px';
}
if (index < length - 1) {
apps[index + 1].style.height = '125px';
apps[index + 1].style.width = '125px';
}
// Resize the outer neighboring apps
if (index > 1) {
apps[index - 2].style.height = '110px';
apps[index - 2].style.width = '110px';
}
if (index < length - 2) {
apps[index + 2].style.height = '110px';
apps[index + 2].style.width = '110px';
}
});
item.addEventListener("mouseleave", () => {
// Reset the size of all apps
apps.forEach(app => {
app.style.height = '100px';
app.style.width = '100px';
});
});
});