Collapse Hamburger Menu

It looks like the canvas menu is built in js in XF -> Core -> Structure.js

There's a click handler XF.OffCanvasClick
And menu builder XF.OffCanvasBuilder

I imagine finding where the initial is-active class in there is being applied and preventing it would solve it.
 
I was just searching for this same thing and came up with a way that works but there may be a better way. Hopefully this topic isn't out-dated.

What I ended up doing is creating a template modification on PAGE_CONTAINER along with installing the following add-on:

The "Find" part of the modification is:
<xf:macro name="nav_entry"
arg-navId="{$navSection}"
arg-nav="{$navEntry}"
arg-selected="{{ $navSection == $pageSection }}"
arg-shortcut="{$i}" />
And the "Replace" is:
<xf:if is="$xf.mobileDetect && $xf.mobileDetect.isMobile()">
<xf:macro name="nav_entry"
arg-navId="{$navSection}"
arg-nav="{$navEntry}"
arg-selected=""
arg-shortcut="{$i}" />
<xf:else />
<xf:macro name="nav_entry"
arg-navId="{$navSection}"
arg-nav="{$navEntry}"
arg-selected="{{ $navSection == $pageSection }}"
arg-shortcut="{$i}" />
</xf:if>
Of course if you start off in desktop size and shrink it it'll still be expanded. Or the opposite in the other direction but I wouldn't expect users to be doing that.

Basically, there's no active tab when using a mobile device, which keeps the menu collapsed.
 
Back
Top Bottom