Collapsible Node Categories

Collapsible Node Categories

In XenForo 2.1 there seems to have a been minor code change.

XF 2.0 - Line 7 in node_list_category
Code:
<div class="block-desc">{$node.description|raw}</div></xf:if>
XF 2.1
Code:
<xf:if is="{$node.description}"><span class="block-desc">{$node.description|raw}</span></xf:if>
With the release of XF 2.0.3 we can now use a cookie to store the toggle state of the collapsed nodes which means when the page is loaded the collapsed nodes will load collapsed, before there was a noticeable flicker on page load as the storage type was only stored locally in a users browser.

The changes are:

Before:
Code:
<span id="collapse-{$node.node_id}" class="collapseTrigger collapseTrigger--block is-active" data-xf-click="toggle" data-xf-init="toggle-storage" data-target=".block--category{$node.node_id} .block-body" data-storage-key="_node-{$node.node_id}"></span>
After:
Rich (BB code):
<span id="collapse-{$node.node_id}" class="collapseTrigger collapseTrigger--block {{ !is_toggled('_node-' . $node.node_id) ? ' is-active' : '' }}" data-xf-click="toggle" data-xf-init="toggle-storage" data-storage-type="cookie" data-target=".block--category{$node.node_id} .block-body" data-storage-key="_node-{$node.node_id}"></span>
=======
Before:
Code:
<div class="block-body block-body--collapsible is-active">
After:
Rich (BB code):
<div class="block-body block-body--collapsible {{ !is_toggled('_node-' . $node.node_id) ? ' is-active' : '' }}">
  • Like
Reactions: SkinsForum and DL6
Top