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.
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
<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>
1 Like
@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!