You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not in alpha1 (although it is coming very soon in the next alpha as I have already split the single navbar component into 3 separate components Nav/Collapse/Offcanvas and everything is more flexible with public show/hide methods for any Collapse/Offcanvas).
But in alpha1 you would need to hack around it with something like this (which is a bit simplified and stripped down version - for details, please check the _togglerAnchorShowClick/_togglerAnchorHideClick methods in the alpha1 code):
// Your current navbar init codeconstnavbar1=newSmartMenus(document.querySelector('#navbar1'))// Additional methodsconstsetNavVisibility=function(hide){if(hide&&this._opts.collapsibleResetSubsOnClickOn==='toggler'){this.subHideAll()}constaction=hide ? 'Hide' : 'Show';if(this._collapse){this[`_animate${action}`](this._collapse)}if(this._offcanvas){this[`_animate${action}`](this._offcanvas)}if(this._offcanvasOverlay){this[`_animate${action}`](this._offcanvasOverlay)}}.bind(navbar1);constshowNav=function(){setNavVisibility();}consthideNav=function(){setNavVisibility(true);}
And then you can call showNav()/hideNav() to show/hide any collapse/offcanvas your navbar might contain.
Is there any way to show / hide menu programmatically? I use custom toggle button but can't find any API method for those operations.
The text was updated successfully, but these errors were encountered: