Skip to content

Commit 535074d

Browse files
000-862: mobile navi
1 parent 24113bb commit 535074d

File tree

1 file changed

+11
-54
lines changed

1 file changed

+11
-54
lines changed

_includes/header.html

Lines changed: 11 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,76 +10,33 @@
1010
<span aria-hidden="true"></span>
1111
</a>
1212
</div>
13-
<div class="navbar-menu" id="navMenu">
13+
<div class="navbar-menu" id="navMenu" :class="{ 'is-active': openNav }">
1414
<div class="navbar-start">
1515
{% if site.data.navigation %}
1616
{% for item in site.data.navigation %}
1717
{% if item.dropdown %}
18-
<!-- First-level dropdown (open on click) -->
19-
<div class="navbar-item has-dropdown">
20-
<a href="{{ item.link | relative_url }}" class="navbar-link {% if page.url contains item.link %}is-active{% endif %}" onclick="toggleDropdown(event)">
21-
{{ item.name }}
22-
</a>
18+
<div class="navbar-item has-dropdown is-hoverable {% if site.fixed_navbar == 'bottom' %} has-dropdown-up {% endif %}">
19+
<a href="{{ item.link | relative_url }}" class="navbar-link {% if page.url contains item.link %}is-active{% endif %}">{{ item.name }}</a>
2320
<div class="navbar-dropdown">
2421
{% for subitem in item.dropdown %}
25-
{% if subitem.dropdown %}
26-
<!-- Second-level dropdown (hoverable) -->
27-
<div class="navbar-item has-dropdown is-hoverable">
28-
<a href="{{ subitem.link | relative_url }}" class="navbar-link">{{ subitem.name }}</a>
29-
<div class="navbar-dropdown">
30-
{% for subsubitem in subitem.dropdown %}
31-
<a href="{{ subsubitem.link | relative_url }}" class="navbar-item">{{ subsubitem.name }}</a>
32-
{% endfor %}
33-
</div>
34-
</div>
35-
{% else %}
36-
<a href="{{ subitem.link | relative_url }}" class="navbar-item {% if subitem.link == page.url %}is-active{% endif %}">{{ subitem.name }}</a>
37-
{% endif %}
22+
<a href="{{ subitem.link | relative_url }}" class="navbar-item {% if subitem.link == page.url %}is-active{% endif %}">{{ subitem.name }}</a>
3823
{% endfor %}
3924
</div>
4025
</div>
4126
{% else %}
42-
<!-- Non-dropdown first-level link -->
4327
<a href="{{ item.link | relative_url }}" class="navbar-item {% if item.link == page.url %}is-active{% endif %}">{{ item.name }}</a>
4428
{% endif %}
4529
{% endfor %}
4630
{% endif %}
4731
</div>
32+
<div class="navbar-end">
33+
<a href=""><img src="../../../../flag.png"/></a>
34+
<a class="navbar-item" href="#">
35+
<i class="fas fa-icon-name"></i>
36+
</a>
37+
</div>
4838

4939

5040
</div>
5141
</div>
52-
</nav>
53-
54-
<script>
55-
function toggleDropdown(event) {
56-
event.preventDefault();
57-
58-
// Find the parent dropdown container
59-
const parentItem = event.target.closest('.has-dropdown');
60-
61-
// Toggle the active state
62-
if (parentItem.classList.contains('is-active')) {
63-
parentItem.classList.remove('is-active');
64-
} else {
65-
// Close all other dropdowns
66-
document.querySelectorAll('.navbar-item.has-dropdown.is-active').forEach(item => {
67-
item.classList.remove('is-active');
68-
});
69-
70-
// Open the clicked dropdown
71-
parentItem.classList.add('is-active');
72-
}
73-
}
74-
75-
// Close dropdowns when clicking outside
76-
document.addEventListener('click', function (event) {
77-
const target = event.target;
78-
if (!target.closest('.has-dropdown')) {
79-
document.querySelectorAll('.navbar-item.has-dropdown.is-active').forEach(item => {
80-
item.classList.remove('is-active');
81-
});
82-
}
83-
});
84-
</script>
85-
42+
</nav>

0 commit comments

Comments
 (0)