nav menu which overlays toggle
-
I have a scenario on a website where when the user clicks the hamburger menu the menu shows with an x in the corner to close the menu. the usual toggle button (hamburger button) is below the off-canvas menu.
Any idea how to make this x close the menu? i tried adding the toggle class to the X button but didn’t work, clicking outside the menu also wont close it.
This is in my functions file
[code]
add_theme_support(
'amp',
array(
'nav_menu_toggle' => array(
'nav_container_id' => 'offCanvas',
'nav_container_toggle_class' => 'is-open',
'menu_button_id' => 'menu-toggle',
'menu_button_toggle_class' => 'active',
),
'paired' => true,
)
);
[/code]this is in my top-menu file
[code]
<div class="mobile-toggle small-2 medium-1 hide-for-large cell">
<a><img />&quot; alt=&quot;&amp;lt;?php _e('Open Menu'); ?&amp;gt;&quot;&amp;gt; &amp;lt;br&amp;gt;Menu</a>
&amp;lt;/div&amp;gt;
[/code]my off-canvas section contains
[code]
&amp;lt;button class=&quot;close-button active&quot; aria-label=&quot;Close menu&quot; type=&quot;button&quot; data-close&amp;gt;
&amp;lt;span aria-hidden=&quot;true&quot;&amp;gt;&amp;times;&amp;lt;/span&amp;gt;
&amp;lt;/button&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;div class=&quot;is-drilldown&quot; style=&quot;min-height: 627px; max-width: 306px;&quot;&amp;gt;
&amp;lt;?php wp_nav_menu( array(
'theme_location' =&amp;gt; 'main_menu',
'menu' =&amp;gt; '',
'container' =&amp;gt; '',
'container_class' =&amp;gt; '',
'container_id' =&amp;gt; '',
'menu_class' =&amp;gt; 'mobile-menu',
'menu_id' =&amp;gt; '',
'echo' =&amp;gt; true,
'fallback_cb' =&amp;gt; 'wp_page_menu',
'before' =&amp;gt; '',
'after' =&amp;gt; '',
'link_before' =&amp;gt; '',
'link_after' =&amp;gt; '',
'items_wrap' =&amp;gt; '&amp;lt;ul id = &quot;%1$s&quot; class = &quot;%2$s vertical menu drilldown&quot; data-drilldown data-parent-link=&quot;true&quot;&amp;gt;%3$s</ul>',
'depth' =&amp;gt; 0,
'walker' =&amp;gt; new gs_walker_drilldown,
) ); ?&amp;gt;
&amp;lt;/div&amp;gt;
[/code]I am testing this on a dev machine and the url i added in this ticket is for v0.7.2 I hope to upgrade to 1.1.3 which bar a few issues (like this one) has gone very well as usual.
ps how do you add a code block on here…
- This topic was modified 5 years, 5 months ago by .
- This topic was modified 5 years, 5 months ago by .
The page I need help with: [log in to see the link]
- The topic ‘nav menu which overlays toggle’ is closed to new replies.