-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from miquigz/navbarresponsive#22
feat: responsive navbar #22
- Loading branch information
Showing
4 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
document.addEventListener("DOMContentLoaded", function () { | ||
var menuButton = document.querySelector(".menu-button"); | ||
var menu = document.querySelector(".nav-links"); | ||
|
||
function hideMenu() { | ||
menu.classList.add("hide-on-mobile"); | ||
menu.classList.remove("show-on-mobile"); | ||
} | ||
|
||
menuButton.addEventListener("click", function () { | ||
let menuClass = menu.classList; | ||
if (menuClass.contains("show-on-mobile")) { | ||
hideMenu(); | ||
} else { | ||
menu.classList.add("show-on-mobile"); | ||
menu.classList.remove("hide-on-mobile"); | ||
} | ||
}); | ||
|
||
menu.addEventListener("click", hideMenu); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
<nav> | ||
<div class="menu-button"> | ||
<span > | ||
<img alt="mobile menu" src="{{"img/menu.svg"|relURL}}" alt=""/> | ||
</span> | ||
</div> | ||
|
||
<nav class="nav-links hide-on-mobile"> | ||
<a href="/">Inicio</a> | ||
<a href="/biografia">Biografía</a> | ||
<a href="/proyectos">Proyectos</a> | ||
<a href="/posts">Posts</a> | ||
<a href="/colaboradores">Colaboradores</a> | ||
<a href="/contacto">Contacto</a> | ||
</nav> | ||
|
||
|
||
{{ $mobileHeader := resources.Get "js/header-mobile.js" }} | ||
<script src="{{ $mobileHeader.Permalink }}" defer></script> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.