Skip to content

Commit e3ba8b0

Browse files
committed
finalizado header pag principal
1 parent bae2356 commit e3ba8b0

File tree

3 files changed

+86
-8
lines changed

3 files changed

+86
-8
lines changed

app.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var boton_menu = document.getElementById("boton_menu");
2+
var img_menu = document.getElementById("img_menu");
3+
var nav = document.getElementById("nav");
4+
var activo = true;
5+
6+
boton_menu.addEventListener("click", () => {
7+
boton_menu.classList.toggle('hacerAnimacion');
8+
9+
//toggle style
10+
if (activo) {
11+
img_menu.style.opacity = 0;
12+
nav.style.transform = 'translateY(0%)';
13+
activo = false;
14+
} else {
15+
img_menu.style.opacity = 1;
16+
nav.style.transform = 'translateY(-100%)';
17+
activo = true;
18+
}
19+
});

index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<body>
1111
<header>
1212
<button id="boton_menu"><img id="img_menu" src="img/boton_menu.svg" alt="Imagen menu hamburguesa"></button>
13+
<nav id="nav">
14+
<a href="#" class="item_menu">Inicio</a>
15+
<a href="#" class="item_menu">Proyectos</a>
16+
<a href="#" class="item_menu">Cursos</a>
17+
<a href="#" class="item_menu">Contacto</a>
18+
</nav>
1319
</header>
1420
<main>
1521

@@ -18,5 +24,7 @@
1824
<footer>
1925

2026
</footer>
27+
28+
<script src="app.js"></script>
2129
</body>
2230
</html>

style.css

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300&display=swap');
2+
13
html, body {
24
height: 100%;
35
margin: 0;
6+
font-family: 'Raleway', sans-serif;
47
}
58

69
header {
@@ -15,11 +18,14 @@ header {
1518
#img_menu {
1619
padding: 5px;
1720
border-radius: 7px;
18-
transition: opacity 0.3s ease-in-out;
21+
transition: opacity 0.35s ease-in-out;
1922
height: 32px;
23+
z-index: 0;
2024
}
2125

2226
#boton_menu {
27+
position: absolute;
28+
z-index: 1;
2329
display: flex;
2430
justify-content: center;
2531
align-items: center;
@@ -39,14 +45,59 @@ header {
3945
transition: transform 0.3s ease-in-out;
4046
}
4147

42-
#boton_menu:hover #img_menu {
43-
opacity: 0;
44-
}
45-
46-
#boton_menu:hover::after {
48+
.hacerAnimacion::after {
4749
transform: rotate(45deg);
4850
}
4951

50-
#boton_menu:hover::before {
52+
.hacerAnimacion::before {
5153
transform: rotate(-45deg);
52-
}
54+
}
55+
56+
#nav {
57+
display: flex;
58+
flex-direction: column;
59+
position: absolute;
60+
left: 0;
61+
right: 0;
62+
top: 0;
63+
box-sizing: border-box;
64+
height: auto;
65+
width: 100%;
66+
z-index: 0;
67+
overflow: hidden;
68+
transform: translateY(-100%);
69+
transition: transform 0.3s ease-in-out;
70+
}
71+
72+
.item_menu {
73+
display: flex;
74+
justify-content: center;
75+
align-items: center;
76+
font-size: 2em;
77+
height: 70px;
78+
width: 100%;
79+
background-color: #484848;
80+
text-decoration: none;
81+
text-emphasis: none;
82+
color: white;
83+
border-bottom: 1px solid white;
84+
z-index: 0;
85+
}
86+
87+
88+
.item_menu::before {
89+
content: " ";
90+
position: absolute;
91+
display: block;
92+
height: 70px;
93+
width: 100%;
94+
background-color: #E04545;
95+
transform: translateY(500px);
96+
z-index: -1;
97+
transition: transform 0.4s ease-in-out;
98+
99+
}
100+
101+
.item_menu:hover::before {
102+
transform: translateY(0%);
103+
}

0 commit comments

Comments
 (0)