This tutorial provides the CSS code to set auto height for the mobile menu (vs the default full screen) in Oxygen.

Add this CSS:

/* Mobile Nav */

@media only screen and (max-width: 768px) {

    body {
        position: relative;
    }

    .admin-bar .oxy-menu-toggle {
        top: 66px;
    }

    .oxy-nav-menu {
        transition: all 0.35s ease;
    }

    .oxy-nav-menu.oxy-nav-menu-open {
        display: block;
        bottom: auto;
            background-color: #fafafa;
            border-bottom: 1px solid #ddd;
    }

    .oxy-nav-menu.oxy-nav-menu-open .oxy-nav-menu-list .menu-item a {
        justify-content: flex-start;
    }

    .oxy-nav-menu.oxy-nav-menu-open.oxy-nav-menu-responsive-dropdowns .menu-item .sub-menu {
        padding-left: 20px;
    }

    .oxy-nav-menu.oxy-nav-menu-open .sub-menu .menu-item a {
        padding-top: 0 !important;
    }

}

Change 768px to the width at which your regular nav collapses into a mobile menu.

Bonus:

If you want the hamburger menu icon to be fixed and always be visible, add the following additionally inside your media query (768px in the above example):

.oxy-menu-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px;
    border: 1px solid #6799b2;
    border-radius: 2px;
    background-color: #fff;
}

.oxy-nav-menu-open .oxy-menu-toggle {
    position: static;
    border: none;
    padding: 0;
}

.oxy-header-wrapper {
    position: static;
}

.oxy-header-container,
.oxy-nav-menu-prevent-overflow {
    height: auto;
}

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
  • Hi Sridhar

    thanks for your great tutorials

    I’ve followed this tutorial and everything works as it should. However there are 2 questions I have.

    You don’t say specifically where to place the CSS so I added a code block to the menu and placed it there. As I said it works but was I placing the CSS in the correct way?

    The one problem I have with this is that the hamburger menu, which I’ve displayed permanently, disappears behind a slider I have at the top of the page and reappears when the page has scrolled down far enough. I’m guessing it’s an index issue but do you have any idea how I can fix this? The slider is Smart Slider 3 plugin

    cheers – Roy

  • >
    linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
    %d bloggers like this: