AFTER hours of trying the dropdown menu is now up to stanard from Patrick_Pluto
This commit is contained in:
parent
2055990ba9
commit
f2895a3b0e
4 changed files with 33 additions and 15 deletions
24
burger.js
24
burger.js
|
@ -1,6 +1,24 @@
|
||||||
// @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0
|
// @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0
|
||||||
|
// burger.js
|
||||||
|
|
||||||
function toggleMenu() {
|
function toggleMenu() {
|
||||||
const menu = document.querySelector(".menu");
|
const menu = document.querySelector(".menu");
|
||||||
menu.classList.toggle("active");
|
menu.classList.toggle("active");
|
||||||
|
|
||||||
|
// Add event listener to close menu when clicking anywhere on the document
|
||||||
|
if (menu.classList.contains("active")) {
|
||||||
|
document.addEventListener("click", closeMenu);
|
||||||
|
} else {
|
||||||
|
document.removeEventListener("click", closeMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// @license-end
|
|
||||||
|
function closeMenu(event) {
|
||||||
|
const menu = document.querySelector(".menu");
|
||||||
|
if (!menu.contains(event.target) && !event.target.classList.contains("burger-menu")) {
|
||||||
|
menu.classList.remove("active");
|
||||||
|
document.removeEventListener("click", closeMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @license-end
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Header extends HTMLElement {
|
||||||
<header>
|
<header>
|
||||||
<div class="header-content">
|
<div class="header-content">
|
||||||
<div class="project-name"><a href="../index.html">FOSS alternatives</a></div>
|
<div class="project-name"><a href="../index.html">FOSS alternatives</a></div>
|
||||||
<button class="burger-menu" onclick="toggleMenu()">☰</button>
|
<button class="burger-menu" style="display: block;" onclick="toggleMenu()">☰</button>
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
<li><a href="../games/index.html">Games</a></li>
|
<li><a href="../games/index.html">Games</a></li>
|
||||||
<li><a href="../general_purpose/index.html">General Purpose</a></li>
|
<li><a href="../general_purpose/index.html">General Purpose</a></li>
|
||||||
|
@ -28,5 +28,5 @@ class Header extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define('header-component', Header);
|
customElements.define('header-component', Header);
|
||||||
customElements.define('header-component', Header);
|
|
||||||
// @license-end
|
// @license-end
|
2
list.css
2
list.css
|
@ -4,7 +4,7 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: "Roboto", Arial, sans-serif;
|
font-family: "Roboto", Arial, sans-serif;
|
||||||
transition: all 0.3s ease; /* Smooth transitions */
|
transition: all 2s ease; /* Smooth transitions */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Body styles */
|
/* Body styles */
|
||||||
|
|
18
styles.css
18
styles.css
|
@ -4,7 +4,7 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: "Roboto", Arial, sans-serif;
|
font-family: "Roboto", Arial, sans-serif;
|
||||||
transition: all 0.3s ease; /* Smooth transitions */
|
transition: all 2s ease; /* Smooth transitions */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Body styles */
|
/* Body styles */
|
||||||
|
@ -21,7 +21,7 @@ body {
|
||||||
/* Header styles */
|
/* Header styles */
|
||||||
header {
|
header {
|
||||||
background-color: #2c3e50;
|
background-color: #2c3e50;
|
||||||
padding: 15px 0;
|
padding: 15px 0; /* Adjusted padding */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -36,12 +36,12 @@ header {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0 20px;
|
padding: 0 20px; /* Original padding */
|
||||||
}
|
}
|
||||||
|
|
||||||
.project-name {
|
.project-name {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 1.8em;
|
font-size: 1.5em; /* Updated font size */
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ header {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 1.8em;
|
font-size: 1.5em; /* Updated font size */
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -64,13 +64,13 @@ header {
|
||||||
}
|
}
|
||||||
|
|
||||||
header li {
|
header li {
|
||||||
margin: 15px;
|
margin: 10px; /* Smaller margin */
|
||||||
}
|
}
|
||||||
|
|
||||||
header a {
|
header a {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
padding: 10px;
|
padding: 8px; /* Smaller padding */
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
@ -198,11 +198,11 @@ nav {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 20px 0 20px;
|
padding: 0 20px; /* Original padding */
|
||||||
}
|
}
|
||||||
|
|
||||||
.project-name {
|
.project-name {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em; /* Updated font size */
|
||||||
}
|
}
|
||||||
|
|
||||||
header li {
|
header li {
|
||||||
|
|
Loading…
Reference in a new issue