mirror of
https://gitlab.com/brutaldon/brutaldon.git
synced 2024-12-04 14:46:24 -05:00
Fix issue of mobile without javascript not having a menu
This commit is contained in:
parent
ff2754e33b
commit
7e449992f4
@ -27,14 +27,8 @@
|
||||
<img src="{% static "images/brutaldon.png" %}"
|
||||
width="32" height="32" alt="Brutaldon">
|
||||
</a>
|
||||
<a role="button" class="navbar-burger" aria-label="menu"
|
||||
aria-expanded="false" data-target="navMenu">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a> <!-- navbar items, navbar burger... -->
|
||||
</div>
|
||||
<div class="navbar-menu" id="navMenu">
|
||||
<div class="navbar-menu is-active" id="navMenu">
|
||||
<!-- navbar start, navbar end -->
|
||||
<div class="navbar-start">
|
||||
<a href="{% url "home" %}" class="navbar-item">Home</a>
|
||||
@ -64,6 +58,26 @@
|
||||
{% if not fullbrutalism %}
|
||||
<script type="application/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Remove is-active from navbar menu
|
||||
var menu = document.querySelector('#navMenu');
|
||||
menu.classList.remove('is-active');
|
||||
|
||||
// Add the burger
|
||||
var brand = document.querySelector('.navbar-brand');
|
||||
var burger = document.createElement('a');
|
||||
burger.classList.toggle('navbar-burger');
|
||||
burger.setAttribute("aria-label", "menu");
|
||||
burger.setAttribute("aria-expanded", "false");
|
||||
burger.setAttribute("data-target", "navMenu");
|
||||
for (var index = 0; index < 3; index++)
|
||||
{
|
||||
var span = document.createElement('span');
|
||||
span.setAttribute('aria-hidden', "true");
|
||||
burger.appendChild(span);
|
||||
}
|
||||
brand.appendChild(burger);
|
||||
|
||||
|
||||
|
||||
// Get all "navbar-burger" elements
|
||||
var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user