fix(Home): mobile menu ux
This commit is contained in:
parent
bedcc818eb
commit
6bf1956e4a
3 changed files with 34 additions and 8 deletions
|
@ -14,7 +14,16 @@ let mosaic = document.getElementById('mosaic');
|
||||||
let mosaicHeader = document.getElementById('mosaic-header');
|
let mosaicHeader = document.getElementById('mosaic-header');
|
||||||
let tags = []
|
let tags = []
|
||||||
|
|
||||||
|
let navEnablerExists = false
|
||||||
|
|
||||||
|
function closeMenu() {
|
||||||
|
navEnablerText.textContent = oldNavText;
|
||||||
|
navEnablerIcon.style.transform = "rotate(0deg)";
|
||||||
|
navContent.style.maxHeight = null;
|
||||||
|
}
|
||||||
|
|
||||||
navEnabler.onclick = async () => {
|
navEnabler.onclick = async () => {
|
||||||
|
navEnablerExists = true
|
||||||
if (!navOpened) {
|
if (!navOpened) {
|
||||||
// open the menu
|
// open the menu
|
||||||
oldNavText = navEnablerText.textContent;
|
oldNavText = navEnablerText.textContent;
|
||||||
|
@ -22,12 +31,9 @@ navEnabler.onclick = async () => {
|
||||||
navEnablerIcon.style.transform = "rotate(90eg)";
|
navEnablerIcon.style.transform = "rotate(90eg)";
|
||||||
navContent.style.maxHeight = navContent.scrollHeight + "px";
|
navContent.style.maxHeight = navContent.scrollHeight + "px";
|
||||||
} else {
|
} else {
|
||||||
// close the menu
|
closeMenu()
|
||||||
navEnablerText.textContent = oldNavText;
|
|
||||||
navEnablerIcon.style.transform = "rotate(0deg)";
|
|
||||||
navContent.style.maxHeight = null;
|
|
||||||
}
|
}
|
||||||
navOpened = !navOpened;
|
navOpened = !navOpened
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEl(className = false, elName = "div") {
|
function createEl(className = false, elName = "div") {
|
||||||
|
@ -155,6 +161,7 @@ let currentTag = null
|
||||||
let currentCardContainer = null
|
let currentCardContainer = null
|
||||||
|
|
||||||
function enableTag(node) {
|
function enableTag(node) {
|
||||||
|
|
||||||
let all = node.id === 'nav-all'
|
let all = node.id === 'nav-all'
|
||||||
let tagId = ""
|
let tagId = ""
|
||||||
if (!all) {
|
if (!all) {
|
||||||
|
@ -180,6 +187,15 @@ function enableTag(node) {
|
||||||
} else {
|
} else {
|
||||||
mosaicHeader.textContent = data.length + " associations listées"
|
mosaicHeader.textContent = data.length + " associations listées"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// close the menu if on mobile
|
||||||
|
if (navEnablerExists) {
|
||||||
|
setTimeout(() => {
|
||||||
|
navOpened = !navOpened
|
||||||
|
closeMenu()
|
||||||
|
location.hash = "#nav-content"
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
|
@ -165,6 +165,7 @@
|
||||||
.mosaic {
|
.mosaic {
|
||||||
background: white;
|
background: white;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding-bottom: .25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mosaic-header {
|
.mosaic-header {
|
||||||
|
@ -332,6 +333,11 @@
|
||||||
max-height: 0;
|
max-height: 0;
|
||||||
transition: max-height 0.1s ease-out;
|
transition: max-height 0.1s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.before-container {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
@ -346,6 +352,7 @@
|
||||||
}
|
}
|
||||||
.mosaic-header {
|
.mosaic-header {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
.card {
|
.card {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -355,6 +362,7 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
border-bottom: 1px solid #C4C4C4;
|
border-bottom: 1px solid #C4C4C4;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.card-content {
|
.card-content {
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
|
@ -49,9 +49,11 @@ Github: https://github.com/lefuturiste
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="before-container">
|
||||||
<div class="content">
|
<div class="container">
|
||||||
{% block content %}{% endblock %}
|
<div class="content">
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Reference in a new issue