-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu(1).html
118 lines (117 loc) · 4.5 KB
/
Menu(1).html
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Menu</title>
<style>
body{
background-color: rgb(20, 20, 20);
margin: 0;
}
#menu{
height: 100vh;
display: flex;
align-items: center;
}
.menu-item{
color: white;
font-size: clamp(3rem, 8vw, 8rem);
font-family: "Ibarra Real Nova", serif;
display: block;
text-decoration: none;
padding: clamp(0.25rem, 0.5vw, 1rem) 0rem;
transition: opacity 400ms ease;
}
#menu-items{
margin-left: clamp(4rem, 20vw, 48rem);
position: relative;
z-index: 2;
}
#menu-items:hover > .menu-item{
opacity: 0.3;
}
#menu-items:hover > .menu-item:hover {
opacity: 1;
}
#menu-background-pattern{
height: 100vh;
width: 100vw;
background-image: radial-gradient( rgba(2255, 255, 255, 0.1) 9%, transparent 9%);
background-position: 0% 0%;
background-size: 12vmin 12vmin;
position: absolute;
left: 0px;
top: 0px;
z-index: 1;
transition: opacity 800ms ease, background-size 800ms ease, background-position 1s ease;
}
#menu-items:hover ~ #menu-background-pattern{
background-size: 11vmin 11vmin;
opacity: 0.5;
}
#menu[data-active-index = '0'] > #menu-background-pattern{
background-position: 0% -25%;
}
#menu[data-active-index = '1'] > #menu-background-pattern{
background-position: 0% -50%;
}
#menu[data-active-index = '2'] > #menu-background-pattern{
background-position: 0% -75%;
}
#menu[data-active-index = '3'] > #menu-background-pattern{
background-position: 0% -100%;
}
#menu-background-image{
height: 100%;
width: 100%;
background-image: url('https://caretokeep.com/wp-content/uploads/2021/08/cleaning-hands-after-gardening.jpg');
position: absolute;
left: 0;
top: 0;
z-index: 0;
background-position: center 40%;
background-size: 130vmax;
background-repeat: no-repeat;
opacity: 0.15;
transition: opaicty 800ms ease, background-size 800ms ease, background-position 800ms ease;
}
#menu-items:hover ~ #menu-background-image{
background-size: 110vmax;
}
#menu[data-active-index = '0'] > #menu-background-image{
background-position: center 45%;
}
#menu[data-active-index = '1'] > #menu-background-image{
background-position: center 55%;
}
#menu[data-active-index = '2'] > #menu-background-image{
background-position: center 65%;
}
#menu[data-active-index = '3'] > #menu-background-image{
background-position: center 75%;
}
</style>
</head>
<body>
<div id="menu">
<div id="menu-items">
<a href="#" class="menu-item">Home</a>
<a href="#" class="menu-item">Shop</a>
<a href="#" class="menu-item">About</a>
<a href="#" class="menu-item">Contact Us</a>
</div>
<div id="menu-background-pattern"></div>
<div id="menu-background-image"></div>
</div>
<script>
const menu = document.querySelector("#menu");
Array.from(document.querySelectorAll(".menu-item")).forEach((item, index) => {
item.onmouseover = () => {
menu.dataset.activeIndex = index;
}
});
</script>
</body>
</html>