Hello,
I have a one page modular site and I would like to have the modular menu with mobile or tablet.
At the moment, the mobile menu is empty (only one modular page on my site). I have made an hinerited them from quark. Is there any way to force the mobile.menu to liste the module.menu advises ?
Here is my page : http://bruno-servirlhumanite.fr
Thanks for the help.
Solved by Vadym View solution
try this
in your inheritance theme in templates folder
create a folder named partials (if it doesn't already exists)
then copy from Quark file navigation.html.twig
and replace code with
TWIG
<ul {{ tree ? 'class="tree"' : '' }}>
{% if show_onpage_menu %}
{% script at 'bottom' %}
$('.overlay-menu a').click(function () {
$('#toggle').toggleClass('active');
$('#overlay').toggleClass('open');
$('body').toggleClass('mobile-nav-open');
});
{% endscript %}
{% for module in page.collection() if module.header.visible is not same as(false) %}
{% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
<li><a class="{{ current_module }}" href="#{{ module.menu|hyphenize }}">{{ module.menu }}</a></li>
{% endfor %}
{% for mitem in site.menu %}
<li>
<a {% if mitem.class %}class="{{ mitem.class }}"{% endif %} href="{{ mitem.url }}">
{% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
{{ mitem.text }}
</a>
</li>
{% endfor %}
{% else %}
{% import 'macros/macros.html.twig' as macros %}
{{ macros.nav_loop(pages) }}
{% endif %}
</ul>
@b.da Thanks a lot, that is exactly what I was looking for. I kept the first ligne of the navigation.html.twig file and copy the code you gave me and... that's all!
I am happy with it. Best regards.
This really helped me out as well. Thanks!
Quark2 behaves the same way as Quark in this regard. What would be the solution for Quark2? (see my post here: https://getgrav.org/forum/themes-styling/grav2-with-quark2-all-pages-in-the-hamburger-menu-of-a-one-pager-t9485)
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 4 | 2 hours ago | ||
| 1 | 173 | 1 week ago | ||
| 0 | 154 | 2 weeks ago | ||
| 4 | 647 | 1 month ago | ||
| 1 | 943 | 1 month ago |