Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solved issue #1922 #1960

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<link rel="stylesheet" href="./mobileView.css" />
<link rel="stylesheet" href="./style_PetCards.css" />
<link rel="icon" type="image/x-icon" href="logo.png" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />



<script defer src="https://unpkg.com/[email protected]/dist/cdn.min.js"></script>
Expand Down Expand Up @@ -51,19 +53,9 @@ <h1 class="text-4xl text_2 text-center md:text-left md:ml-12 uppercase font-ser
id="nav-button"
>
<span class="sr-only">Open main menu</span>
<svg
class="w-6 h-6"
aria-hidden="true"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
clip-rule="evenodd"
></path>
</svg>
<span class="material-symbols-outlined">
menu
</span>
</button>
<nav class="">
<div class="hidden w-full lg:block z-2" id="navbar">
Expand Down
15 changes: 15 additions & 0 deletions navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ const navBar = document.getElementById("navbar");
const logo = document.getElementById("logo");
const navBtn = document.getElementById("nav-button");

// Get the nav-button and the span element
const menuSpan = navBtn.querySelector('.material-symbols-outlined');

// Add an event listener to the nav-button
navBtn.addEventListener('click', () => {
// Check the current text content of the span element
if (menuSpan.textContent === 'close') {
// Change the text content to 'close'
menuSpan.textContent = 'menu';
} else {
// Change the text content back to 'menu'
menuSpan.textContent = 'close';
}
});

let prevScrollPos = window.pageYOffset

navBtn.addEventListener("click", () => {
Expand Down