XF 2.0 Conditionals in EXTRA.less possible?

pjfry

Active member
Hello,

are conditionals in EXTRA.less allowed and possible?

I tried this code:

CSS:
<xf:if is="$xf.visitor.is_admin OR $xf.visitor.is_moderator">
    .p-header-logo {
        position: absolute;
        left: 160px;
        top: 160px;
        color: #f2e019;
        text-shadow: 0px 0px 10px #f2e019, 0px 0px 6px #e43f19;
    }

<xf:else />

    .p-header-logo {
        position: absolute;
        left: 160px;
        top: 125px;
        color: #f2e019;
        text-shadow: 0px 0px 10px #f2e019, 0px 0px 6px #e43f19;
    }

</xf:if>

Ans it doesn't work for admins. I want a absolute postions for my logo relative to the header which works, but with teh staff bar my logo is not in the right place.

Thanks

Benny
 
Absolute positioning isn't usually an ideal way to align a logo.. If this is necessary, it suggests that maybe your HTML isn't coded correctly. Recoding the header so it doesn't depend on absolute values would be the ideal outcome.

If this isn't possible for some reason, use a conditional to add a "moderator-bar-visible" class to the <html> tag in PAGE_CONTAINER, and then use css to target the logo like so:
Less:
.p-header-logo {
    position: absolute;
    left: 160px;
    top: 125px;
    color: #f2e019;
    text-shadow: 0px 0px 10px #f2e019, 0px 0px 6px #e43f19;
    
    .moderator-bar-visible &{
        top: 160px;
    }
}
 
I'm assuming your moderator bar is inside the <header> tag.

If you place your moderator bar before the <header> tag (not inside it), you won't need the above conditional :)
 
Back
Top Bottom