Testing new menu

This commit is contained in:
Fred Boniface 2022-10-30 20:36:17 +00:00
parent f4dc85e434
commit b368e65bd9
3 changed files with 58 additions and 82 deletions

View File

@ -1,19 +1,11 @@
/* When the user clicks on the button, function sidebarOpen() {
toggle between hiding and showing the dropdown content */ document.getElementById("sidebar").style.width = "50%";
function myFunction() { document.getElementById("sidebar_open_short").style.display = "none";
document.getElementById("myDropdown").classList.toggle("show"); document.getElementById("sidebar_close_short").style.display = "block";
} }
// Close the dropdown menu if the user clicks outside of it function sidebarClose() {
window.onclick = function(event) { document.getElementById("sidebar").style.width = "0%"
if (!event.target.matches('.dropbtn')) { document.getElementById("sidebar_open_short").style.display = "block";
var dropdowns = document.getElementsByClassName("dropdown-content"); document.getElementById("sidebar_close_short").style.display = "none";
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
} }

View File

@ -1,10 +1,11 @@
<?php <div id="menubar_hamburger" class="hide_micro">
<button class="sidebar_control" id="sidebar_open_short" onclick="sidebarOpen()">&#9776;</button>
echo '<div class="dropdown">'; <button class="sidebar_control" id="sidebar_close_short" onclick="sidebarClose()">&times;</button>
echo ' <button onclick="myFunction()" class="dropbtn">Menu</button>'; </div>
echo ' <div id="myDropdown" class="dropdown-content">'; <div id="sidebar">
echo ' <a class="dropdown-first" href="/">Home</a>'; <a href="/">Home</a>
echo ' <a href="/issue.php">Report Issue</a>'; <a href="/keys.php">Keys</a>
echo ' <a href="/help.php">Help</a>'; <a href="/projects.php">Things I Do</a>
echo ' </div>'; <a href="/contact.php">Contact</a>
echo '</div>'; <a href="/about.php">About</a>
</div>

View File

@ -117,67 +117,50 @@ body {
} }
/* START MENU STYLE */ /* START MENU STYLE */
#menubar_hamburger {
/* Menu Button */
.dropbtn {
position: fixed;
top: 0;
right: 0;
background-color: #7fa7e6;
color: white;
padding: 12px;
font-size: 12px;
box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);
border: none;
border-bottom-left-radius: 10px;
cursor: pointer;
}
.dropbtn:hover, .dropbtn:focus {
background-color: #0280e5;
}
/* The container <div> - needed to position the dropdown content */
.dropdown {
position: relative;
display: inline-block;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute; position: absolute;
top: -80px; top: 2px;
/*right: -190px;*/ right: 0;
left: 150px; padding: 5px;
background-color: #7fa7e6;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
} }
.sidebar_control {
/* Links inside the dropdown */ background-color: transparent;
.dropdown-content a { color: whitesmoke;
color: white; border: none;
padding: 12px 16px; font-family: sans-serif;
text-decoration: none; font-size: larger;
}
#sidebar_open_short {display: block;}
#sidebar_close_short {
display: none;
font-size: x-large;
}
#sidebar {
position: fixed;
top: 40px;
right: 0;
margin: auto;
height: 100%;
display: block; display: block;
border-bottom: 1px solid black; max-width: 250px;
width: 0;
background-color: navy;
transition: 0.4s;
} }
#sidebar a {
/*Final item of the dropdown has bottom border*/ padding: 8px 8px 8px 8px;
.dropdown-first { margin-top: 10px;
border-top: 1px solid black; font-family: indie-flower, sans-serif;
font-weight: 300;
text-decoration: none;
text-align: center;
font-size: 25px;
color: white;
display: block;
white-space: nowrap;
transition: 0.5s;
} }
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #ddd;}
/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {display:block;}
/* END MENU STYLE */
/* Footer Styles */ /* Footer Styles */
/* Footer Styles */ /* Footer Styles */