[cXF] Mobile logo header

[cXF] Mobile logo header

BassMan

Well-known member
BassMan submitted a new resource:

[cXF] Mobile logo header - Show logo in mobile header, but in navigation when scrolling

Would you like to have a mobile header with logo like this?

View attachment 213361



As you can see you can have a mobile header, but when you scroll the logo will show in the navigation.

To achieve this add code below to extra.less template:

Less:
/* [cXF] Mobile logo header */
@media (max-width: @xf-responsiveMedium) {
    .has-js .p-header {
        display: initial;
    }
    .p-header-logo {
        max-width: 100%;
        margin: 0 auto;
    }...

Read more about this resource...
 
I suppose it may depend on the size and position of the logo but on the sites I manage they already do that, both in the PixelExit styles and in the XF default.

I'm confused about what this mod adds or does differently? I can see that in your example the original logo is centered so it gets bumped down and left-aligned but more often the logo is left-aligned to begin with, is it not?
 
What I'm seeing browsing other Xenforo forums is if the original logo is centered or full-width, then it doesn't show in the nav bar. If it is left aligned (and maybe not too large if a mobile logo is undefined), then your mod kicks in. Is that correct?

By the way, I'm not trying to be argumentative here at all. I'm just trying to understand when the mod makes a difference and when it doesn't.
 
@djbaxter If I may.... the question is not whether the logo shows up or not but where. Normally the XF mobile navbar is a single line with the hamburger menu, logo, and the icons. What this CSS is doing is displaying two lines when the page loads with the logo on line #1 and then the hamburger menu & icons on line #2. When you start to scroll on the page it then switches to the normal single line (hamburger / logo / icons). Check post #10 above... the first screen shot with the red square you'll see a larger then usual logo on mobile on line #1 with the hamburger & icons on line #2 but if you notice the last image in that post the mobile menu has switched back to the "normal" XF display after scrolling.

In short; with this change you'll see two lines on page load and then the normal single line after scrolling.
 
Hello

I still see the mini logo when i'm at the top of the page it don't disappear.
For UI.X style use this code:

Less:
/* [cXF] Mobile logo header (for UI.X style) */
@media (max-width: @xf-responsiveMedium) {
    .has-js .p-header {
        display: initial;
    }
    .p-header-logo {
        max-width: 100%;
        margin: 0 auto;
    }
    .p-header-logo.p-header-logo--image img {
        max-height: 80px;
    }
    .p-navSticky .p-header-logo {
        opacity: 0;
        transition: all .25s ease;
        margin: 0;
    }
    .p-navSticky.is-sticky .p-header-logo {
        opacity: 1;
        transition: all .25s ease;
        margin: 0;
    }
    /* to hide icons in header if you're using [cXF] Icons in Header add-on */
    .cxf_icons_header_container {
        display: none;
    }
}
/*****/
 
For UI.X style use this code:

Less:
/* [cXF] Mobile logo header (for UI.X style) */
@media (max-width: @xf-responsiveMedium) {
    .has-js .p-header {
        display: initial;
    }
    .p-header-logo {
        max-width: 100%;
        margin: 0 auto;
    }
    .p-header-logo.p-header-logo--image img {
        max-height: 80px;
    }
    .p-navSticky .p-header-logo {
        opacity: 0;
        transition: all .25s ease;
        margin: 0;
    }
    .p-navSticky.is-sticky .p-header-logo {
        opacity: 1;
        transition: all .25s ease;
        margin: 0;
    }
    /* to hide icons in header if you're using [cXF] Icons in Header add-on */
    .cxf_icons_header_container {
        display: none;
    }
}
/*****/
Yep, now it works perfectly. I just had to change the max height to 100% because with 80px the logo was deformed
Thank you for your usual responsiveness
 
Back
Top Bottom