Skip to content

Commit 256fe7b

Browse files
committed
got menu working via copy paste code and svg from yarnhelp2.0 into index.html
1 parent a3e0f75 commit 256fe7b

File tree

5 files changed

+120
-0
lines changed

5 files changed

+120
-0
lines changed

assets/exit.svg

+6
Loading

assets/menu.svg

+7
Loading

index.html

+25
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,30 @@
3535

3636
</fieldset>
3737
</form>
38+
<nav>
39+
<img
40+
src="assets/menu.svg"
41+
class="menu"
42+
id="menu-btn"
43+
alt="open menu"
44+
/>
45+
<ul class="nav" id="nav">
46+
<li class="exit" id="/assets/exit-btn">
47+
<img
48+
src="assets/exit.svg"
49+
class="menu"
50+
id="exit-btn"
51+
alt="close menu"
52+
/>
53+
</li>
54+
<li class="active"><a href="index.html">Home</a></li>
55+
<li><a href="howmuchyarn.html">How Much Yarn?</a></li>
56+
<li><a href="doctorwho.html">Doctor Who Scarf</a></li>
57+
<li><a href="crafting-and-code.html">Crafting and Code Coffee Chats and Discord </a>
58+
<li><a href="about.html">About and Contact</a></li>
59+
<li><a href="index01.html">Old Site Version 1.0</a></li>
60+
</ul>
61+
</nav>
3862
<!-- nav here -->
3963
<section class="hero">
4064

@@ -152,5 +176,6 @@ <h3 class="card__title">Developer Information</h3>
152176
</div>
153177
</main>
154178
<script src="/app.js"></script>
179+
<script src="/nav.js"></script>
155180
</body>
156181
</html>

nav.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// -- NAVIGATION --
2+
3+
const get = element => document.getElementById(element);
4+
5+
let open = get("menu-btn");
6+
let nav = get("nav");
7+
let exit = get("exit-btn");
8+
9+
open.addEventListener('click', () => {
10+
nav.classList.add('open-nav');
11+
})
12+
13+
exit.addEventListener('click', () => {
14+
nav.classList.remove('open-nav');
15+
})

styles.css

+67
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,73 @@ margin-bottom: 0.75rem;
321321
margin: 1rem;
322322
}
323323

324+
/* Nav */
325+
326+
nav ul {
327+
visibility: hidden;
328+
opacity: 0;
329+
position: fixed;
330+
width: 100%;
331+
top: 0;
332+
left: 0;
333+
background: var(--clr-body-bg);
334+
height: 100vh;
335+
margin-top: 5rem;
336+
padding-top: 5em;
337+
z-index: 100;
338+
}
339+
340+
nav ul li a {
341+
color: var(--clr-heading1);
342+
font-size: 1.5em;
343+
font-weight: bold;
344+
padding: 1em;
345+
display: block;
346+
}
347+
348+
.exit a {
349+
width: 30px;
350+
height: 30px;
351+
position: absolute;
352+
top: 0;
353+
right: 0;
354+
}
355+
356+
.open-nav {
357+
visibility: unset;
358+
opacity: 1;
359+
transform: translateX(0);
360+
}
361+
362+
.menu {
363+
color: var(--clr-test-lime);
364+
fill: currentColor;
365+
background-color: antiquewhite;
366+
padding: 0.5rem;
367+
border-radius: 0.25rem;
368+
text-align: center;
369+
}
370+
371+
ul.nav {
372+
list-style: none;
373+
}
374+
375+
376+
ul.nav li a {
377+
font-size: 2rem;
378+
padding: 0 1em;
379+
font-weight: normal;
380+
}
381+
382+
ul.nav li:last-child a {
383+
padding-right: 0;
384+
}
385+
386+
ul.nav .active a {
387+
font-weight: bold;
388+
text-decoration: underline;
389+
}
390+
324391
/* ---------------------------- */
325392
/* --- COLOUR THEME PICKER --- */
326393
/* ---------------------------- */

0 commit comments

Comments
 (0)