Mobile-friendly Menu UI
This commit is contained in:
parent
1a47e8143a
commit
1193d70d90
5 changed files with 135 additions and 20 deletions
|
|
@ -437,4 +437,46 @@ button:active {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mobile-menu {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1024;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: none;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: rgba(37, 37, 37, 0.95);
|
||||||
|
color: #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu .close-mobile-menu {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-orient: horizontal;
|
||||||
|
-webkit-box-direction: reverse;
|
||||||
|
-ms-flex-direction: row-reverse;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
justify-items: flex-end;
|
||||||
|
width: 100vw;
|
||||||
|
max-width: 100vw;
|
||||||
|
font-size: 4rem;
|
||||||
|
background-color: rgba(187, 49, 47, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu .close-mobile-menu:hover {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu .item {
|
||||||
|
width: 100vw;
|
||||||
|
height: 10px;
|
||||||
|
max-height: 4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu .sub.item {
|
||||||
|
padding-left: 3rem;
|
||||||
|
background-color: #404040;
|
||||||
|
}
|
||||||
/*# sourceMappingURL=main.css.map */
|
/*# sourceMappingURL=main.css.map */
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -384,3 +384,40 @@ button {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mobile-menu {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1024;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: none;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: rgba($background, 0.95);
|
||||||
|
color: $foreground;
|
||||||
|
|
||||||
|
.close-mobile-menu {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
justify-items: flex-end;
|
||||||
|
width: 100vw;
|
||||||
|
max-width: 100vw;
|
||||||
|
font-size: 4rem;
|
||||||
|
background-color: rgba($darkRed, 0.5);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
width: 100vw;
|
||||||
|
height: 10px;
|
||||||
|
max-height: 4rem;
|
||||||
|
// height: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub.item {
|
||||||
|
padding-left: 3rem;
|
||||||
|
background-color: map-get($dark, "buttonActive");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,23 @@
|
||||||
$(document).ready(function () {
|
const toggleSubMenu = (el) => {
|
||||||
$('.dropdown-submenu a.test').on("click", function (e) {
|
$(`[for="${el.getAttribute("from")}"`).toggle("slide", "down");
|
||||||
$(this).next('ul').toggle();
|
|
||||||
e.stopPropagation();
|
// TODO: do something with these
|
||||||
e.preventDefault();
|
};
|
||||||
|
|
||||||
|
const toggleMenu = () => {
|
||||||
|
$(".mobile-menu").toggle("slide", "left");
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).ready(() => {
|
||||||
|
document.querySelectorAll(".compact.submenu.item").forEach((el) => {
|
||||||
|
let id = `subMenu_${new Date().getMilliseconds()}`;
|
||||||
|
el.setAttribute("from", id);
|
||||||
|
|
||||||
|
el.querySelectorAll(".compact.sub.item").forEach((child) => {
|
||||||
|
child.setAttribute("for", id);
|
||||||
|
child.style.display = "none";
|
||||||
|
child.textContent = `${child.textContent}`;
|
||||||
|
el.parentElement.appendChild(child);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
48
index.html
48
index.html
|
|
@ -22,24 +22,44 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="top titlebar">
|
<div class="top titlebar">
|
||||||
|
|
||||||
|
<div class="mobile-menu">
|
||||||
|
<div class="close-mobile-menu" onclick='toggleMenu()'>
|
||||||
|
<i class="fa fa-close"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="compact item">
|
||||||
|
About
|
||||||
|
</div>
|
||||||
|
<div class="compact item">
|
||||||
|
Github
|
||||||
|
</div>
|
||||||
|
<div class="compact item">
|
||||||
|
Reddit
|
||||||
|
</div>
|
||||||
|
<div class="compact item">
|
||||||
|
YouTube
|
||||||
|
</div>
|
||||||
|
<div class="compact submenu item" onclick="toggleSubMenu(this)">
|
||||||
|
<span>
|
||||||
|
Support <i class="fa fa-caret-down"></i>
|
||||||
|
</span>
|
||||||
|
<div class="compact sub item">
|
||||||
|
Item 1
|
||||||
|
</div>
|
||||||
|
<div class="compact sub item">
|
||||||
|
Item 2
|
||||||
|
</div>
|
||||||
|
<div class="compact sub item">
|
||||||
|
Item 3
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Mobile friendly menu -->
|
<!-- Mobile friendly menu -->
|
||||||
<div class="dropdown item compact">
|
<div class="dropdown item compact" onclick='toggleMenu()'>
|
||||||
<span>
|
<span>
|
||||||
<i class="fa fa-bars"></i> Menu
|
<i class="fa fa-bars"></i> Menu
|
||||||
</span>
|
</span>
|
||||||
<div class="dropdown-content">
|
|
||||||
<div class="dropdown item">
|
|
||||||
<span>
|
|
||||||
Support <i class="fa fa-caret-right"></i>
|
|
||||||
</span>
|
|
||||||
<div class="dropdown-content">
|
|
||||||
<div class="item compact">Link 1</div>
|
|
||||||
<div class="item compact">Link 2</div>
|
|
||||||
<div class="item compact">Link 3</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue