mirror of
https://github.com/rjNemo/orbital-orbit
synced 2026-06-06 06:56:40 +00:00
feat: add interactivity with script
This commit is contained in:
parent
7e01b7e81f
commit
628e4d955e
5 changed files with 30 additions and 1 deletions
5
src/components/Hamburger.astro
Normal file
5
src/components/Hamburger.astro
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div class="hamburger">
|
||||
<span class="line"></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"></span>
|
||||
</div>
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
---
|
||||
import Hamburger from "./Hamburger.astro";
|
||||
import Navigation from "./Navigation.astro";
|
||||
---
|
||||
|
||||
<header>
|
||||
<Hamburger />
|
||||
<Navigation />
|
||||
</header>
|
||||
|
|
|
|||
|
|
@ -19,5 +19,8 @@ const pageTitle = "Orbital Orbit"
|
|||
|
||||
<h1>{pageTitle}</h1>
|
||||
<Footer/>
|
||||
</body>
|
||||
<script>
|
||||
import "../scripts/menu.js"
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
3
src/scripts/menu.js
Normal file
3
src/scripts/menu.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
document.querySelector(".hamburger")?.addEventListener("click", () => {
|
||||
document.querySelector(".nav-links")?.classList.toggle("expanded");
|
||||
});
|
||||
|
|
@ -21,6 +21,18 @@ h1 {
|
|||
}
|
||||
|
||||
/* nav styles */
|
||||
.hamburger {
|
||||
padding-right: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hamburger .line {
|
||||
display: block;
|
||||
width: 40px;
|
||||
height: 5px;
|
||||
margin-bottom: 10px;
|
||||
background-color: #ff9776;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
width: 100%;
|
||||
|
|
@ -63,4 +75,8 @@ h1 {
|
|||
display: inline-block;
|
||||
padding: 15px 20px;
|
||||
}
|
||||
|
||||
.hamburger {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue