Archived topic
off canvas menu button wont work...
7 replies · Started by johnaps on January 10, 2022
Hello!
I have set my menu as primary and off canvas.
I have tried both options in customizer -> layout -> offcanvas (both on & only mobile) and the .menu-toggle up left wont trigger the off canvas menu.
Do you have any ideas please?
Hi there,
Can you try disabling ALL plugins except GP Premium? To see if it's a plugin conflict.
i found it, its off-canvas-sidebars plugin...
David had suggested it in this thread
https://generatepress.com/forums/topic/how-to-make-off-canvas-menu-that-shows-left-sidebar/#post-2071575
Maybe you know how to configure it properly so my offcanvas panel that i want for my filters wont interefe with the offcanvas of gp for my menu?
I tried a few things but didnt quite got it working...
Maybe you know cause it was suggested??
Unfortunately you will need to check with the plugin's support to see why it's causing an issue.
I would assume it's some sort of js conflict.
Thanks for your understanding :)
I contacted their support
https://wordpress.org/support/topic/off-canvas-menu-of-my-theme-wont-work/#post-15259233
That didnt help much.
I have tried this plugin actually cause David suggested it for my offcanvas panel needs....
The only way to achieve what i want now with this plugin is to switch gp's offcanvas functionality off and use gp's menu toggle as a toggle for the plugin to open a panel...
To do that i switched off offcanvas panel.
And i need help with 2 things:
1. i need the element <button data-nav="site-navigation" class="menu-toggle" aria-controls="primary-menu" aria-expanded="true">
to not open anything, as i will open the menu with the plugin.
2. i need to add this css class .ocs-toggle-menu-offcanvas to this element <button data-nav="site-navigation" class="menu-toggle" aria-controls="primary-menu" aria-expanded="true"> so i can make it a trigger for the plugin.
Hi there,
1. It's difficult to prevent GP from doing what it wants to do here. We can try adding some CSS to prevent it from showing the default menu:
.main-navigation.toggled .main-nav > ul {
display: none !important;
}
2. Try this:
add_filter( 'generate_parse_attr', function( $attributes, $context ) {
if ( 'menu-toggle' === $context ) {
$attributes['class'] .= ' ocs-toggle-menu-offcanvas';
}
return $attributes;
}, 10, 2 );
Let me know if that helps or not :)
That did the job beautifully!
Thank you so much Tom! :)
You're welcome :)