Site logo

Archived topic

hide secondary menu once logged in

19 replies · Started by Steig on December 4, 2016

Viewing posts 16–20 of 20

Getting there - lots of variables.

I just adjusted the CSS above to include the mobile header which you have activated: https://generatepress.com/forums/topic/hide-secondary-menu-once-logged-in/#post-251665

When logged in, the black logged in bar that wordpress shows scrolls out of site when going down screen. I could live with that I guess, but it’s different behavior than that desktop version.

This is default WordPress behavior, the admin bar isn't sticky on mobile.

Thank you Tom. It works great. but I still have the problem for devices in the "mobile menu" mode. that clicking the secondary menu causes it to expand behind the header....unless you are at the top of the page. Then it expands over the header.

Here we go, final code (hopefully!):

/* Secondary Nav sticky */
.secondary-navigation {
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 110;
}

/* Keeps below element from moving under header */
body:not(.logged-in) .site-header,
body:not(.logged-in) .mobile-header-navigation {
    margin-top: 30px; /* height of secondary navigation */
}

/* Primary Nav sits below secondary nav */
body:not(.logged-in) .main-navigation.is_stuck,
body:not(.logged-in) .main-navigation.navigation-clone,
body:not(.logged-in) .mobile-header-navigation.is_stuck,
body:not(.logged-in) .mobile-header-navigation.navigation-clone {
    top: 30px !important; /* height of your sticky secondary navigation */
    margin-top: 0;
}

.admin-bar:not(.logged-in) .main-navigation.is_stuck,
.admin-bar:not(.logged-in) .main-navigation.navigation-clone {
    top: 62px !important; /* height of your sticky secondary navigation + 32px */
}

That did it! Thank you so much!!

You're welcome! :)

This archived topic is closed to new replies.