![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
-
AuthorPosts
-
September 17, 2020 at 11:57 pm #1246611
The client wants me to try to mimic a header/menu experience like this website. https://www.madriver.co.uk/capabilities/
I am not sure if i can do all that is shown, but hopefully can do some of it. Using enfold On scroll when the shrinking header takes effect, can I have the main menu switch to the hamburger menu? If so could you give me some css guidance?
Also another element i am noticing midway down the page on scroll the sticky menu disappears completely is this possible with enfold?
September 20, 2020 at 10:18 pm #1247192Hey todd0218,
Sorry for the late reply, to have the menu change on scroll, please try this code in the General Styling > Quick CSS field or in the WordPress > Customize > Additional CSS field:#header.header-scrolled-full .av-burger-menu-main.menu-item-avia-special { display: block; } #header.header-scrolled-full .av-main-nav .menu-item { opacity: 0; pointer-events: none !important; }
To have the menu disappear on scroll about midway we will have to add a class to the header, Try adding this code to the end of your functions.php file in Appearance > Editor:
function custom_header_scrolled_script(){ ?> <script> (function ($) { $(window).scroll(function() { var width = $(window).width(), height = $(window).height(); var scroll = $(window).scrollTop(); if (scroll >= 1200) { $('#header').addClass('header-scrolled-middle'); } else { $('#header').removeClass('header-scrolled-middle'); } }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_header_scrolled_script');
Then add this css:
#header.header-scrolled-middle, #header.header-scrolled-middle #header_main .inner-container { max-height: 0; } #header.header-scrolled-middle .av-burger-menu-main.menu-item-avia-special { display: none; }
Then clear your browser cache and check.
Best regards,
MikeSeptember 21, 2020 at 5:29 pm #1247413Mike! This works excellent. I applied those updates on my dev site.
Only thing I had to do, not sure-if there was an easier way to add something in the css to also change from centered menu to right on scroll. I am using a bunch of media queries and padding push it right.
September 22, 2020 at 2:06 pm #1247626Hi,
Glad to hear this helped, as for moving your burger menu to the right, you css seems to only move it about 20px, correct?
I would recommend removing this css and move the burger menu by making the “av-main-nav-wrap” container 100% width, and then float the “menu-item-avia-special” to the right.
This may move it too far, so try different widths, like 80%
Do you have a mockup of the burger menu placement?Best regards,
MikeSeptember 22, 2020 at 3:50 pm #1247648Hi Mike!
You lead me down a great path. I was able to pull this off doing this for anyone else who has to do this:
.av-main-nav-wrap {
width: 100%;
}
.av-main-nav-wrap ul {
position: relative;
z-index: 3;
width: 100%;
display: flex;
justify-content: center;
}
#header.header-scrolled-full .av-burger-menu-main.menu-item-avia-special {
width: 100%;
display: flex;
justify-content: flex-end;
}September 23, 2020 at 6:17 am #1247741Hi,
I’m glad you found a solution. Did you need additional help with this topic or shall we close?
Best regards,
Jordan ShannonSeptember 24, 2020 at 5:55 pm #1248243you can close!
September 24, 2020 at 7:00 pm #1248253Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Display hamburger menu in shrinking header’ is closed to new replies.