Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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?

    #1247192

    Hey 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,
    Mike

    #1247413

    Mike! 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.

    #1247626

    Hi,
    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,
    Mike

    #1247648

    Hi 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;
    }

    #1247741

    Hi,

    I’m glad you found a solution. Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

    #1248243

    you can close!

    #1248253

    Hi,

    If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Display hamburger menu in shrinking header’ is closed to new replies.