Any way to disable the floating navbar on a per user basis?

RobParker

Registered
Some of our users love the floating/sticky navbar and some hate it.

Is there any way to allow them to turn it on/off themselves?
 

Russ

Pixel Exit Staff
Couple steps, create the userfield:

floatutorial.png



Add this to the template xb_head:

Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.floatingnav}">
<style>.XenBase .p-navSticky.is-sticky { position: relative !important; }</style>
</xf:if>

And... you're done (y).

Screenshot_7.png



Well should be done :), let me know if that works for you.
 

RobParker

Registered
Seems to work perfectly, thanks!

Will I have issues upgrading having edited the template directly? It was an empty template so I assume not but would a template modification be better?
 

Russ

Pixel Exit Staff
Seems to work perfectly, thanks!

Will I have issues upgrading having edited the template directly? It was an empty template so I assume not but would a template modification be better?

xb_head + xb_body will always remain empty for users to use for various JS + CSS items like this (y)
EDIT: So... on upgrading it'll never show outdated.
 

Russ

Pixel Exit Staff
Same method with the custom field check box, but you could change the conditional in xb_head slightly:

Code:
<xf:if contentcheck="true">
    <style>
        <xf:contentcheck>
        <xf:if is="{$xf.visitor.Profile.custom_fields.floatingnav}">.XenBase .p-navSticky.is-sticky { position: relative !important; }</xf:if>
        <xf:if is="{$xf.visitor.Profile.custom_fields.removeavatar}">.XenBase .message-avatar-wrapper { display: none !important; }</xf:if>
        </xf:contentcheck>
    </style>
</xf:if>

This way it'll only load the <style> if at least 1 of the check boxes is checked.
 

Russ

Pixel Exit Staff
p.s. You should make these XenBase options or addons or something.

With it being just a style and not an add-on it's a little limited, unfortunately. We've seen how many problems are caused when other developers use add-ons for their styles and just wanted to avoid that path. So... things like this is usually left best for each board to customize (with our help of course :D).

Code:
.structItem-cell.structItem-cell--icon {
    display: none;
}
Should do it.
 

Pre-Sale Questions

If you have any questions or concerns you want to ask before you make a purchase don't hesitate to use one of our multiple support channels for your convenience.