Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #989459

    Hi There –

    I’d like the main menu to disappear and the burger menu to appear on scroll (on desktop).

    – When page opens, normal menu appears on right (with logo on the left).
    – When user scrolls, sticky main menu is replaced by burger menu (with logo on the left).

    I’ve found a thread similar to my issue, but the code provided is not working for my site.
    (https://kriesi.at/support/topic/ (Purchase code hidden if logged out) /)

    Please advise and thanks so much,
    T

    #989616

    Hey worleytm,

    Thank you for using Enfold.

    That is possible. You can try this script in the functions.php file.

    add_action('wp_footer', 'ava_burger_toggle_on_scroll');
    function ava_burger_toggle_on_scroll(){
    	?>
    	<script type="text/javascript">
    		(function($) {
    			function avia_scroll_top_menu()
    			{
    					var win = $(window),
    						menu = $('.responsive #top .av-main-nav .menu-item'),
    						burger = $('.responsive #top .av-main-nav .menu-item-avia-special, .responsive .av-burger-menu-main'),
    						set_status = function()
    						{
    							var st = win.scrollTop();
    
    							if(st < 200)
    							{
    								menu.addClass('hide_menu_show_burger');
    								menu.removeClass('hide_burger_show_menu');
    								burger.removeClass('hide_menu_show_burger');	
    							}
    							else if(menu.is('.hide_menu_show_burger')) 
    							{
    								burger.addClass('hide_menu_show_burger');
    								menu.removeClass('hide_menu_show_burger');	
    								menu.addClass('hide_burger_show_menu');
    							}
    						};
    
    					win.on( 'scroll',  function(){ window.requestAnimationFrame( set_status )} );
    					set_status();
    			}
    
    			avia_scroll_top_menu();
    		})(jQuery);
    	</script>
    	<?php
    }

    And then add this css code on the Quick CSS field.

    .responsive #top .av-main-nav .menu-item {
      display: none;
    }
    
    .responsive #top .av-main-nav .menu-item-avia-special {
      display: block;
    }
    
    .responsive .av-burger-menu-main {
      display: block;
    }
    
    .hide_menu_show_burger {
      display: none !important;
    }
    
    .hide_burger_show_menu {
      display: block !important;
    }

    Best regards,
    Ismael

    #989768

    Thanks Ismael!
    This is pretty close but I need it to work opposite of how it functions now.
    Currently, burger is shown on load and main nav shows on scroll and I need:
    Main nav to show on load and burger to appear on scroll.
    Thanks again. You guys are awesome.
    Cheers,
    T

    #989781

    Also, the burger menu is blank on click and nothing shows up during flyout.

    #989789

    Hi,

    Could you please post WP admin logins here privately so we can look into it? :)

    Cheers!
    Yigit

    #989793

    Sure thing!

    #990072

    Ok, I used Ismael’s code provided with a few edits (replaced “menu” with “burger” and vice versa) as you can see in the functions.php file in the backend.

    However, now, I’m facing the following issues:

    Safari 11.1.2 – The main nav appears on load (check!), the main nav is replaced by the burger on scroll (great!), but when clicking on the burger, the burger flyout is blank (help!)

    Chrome 67.0.3396.99 – The main nav appears on load and the burger appears to the right of the main nav (help!), the main nav is replaced by the burger on scroll (wonderful!), and the burger flyout shows the navigation (awesome!).

    Any suggestions?

    #990086

    Hi,

    We adjust the script a bit. The mobile menu items display properly now.

    Best regards,
    Ismael

    #990094

    Thanks! I can see that the burger menu on flyout is functioning and not blank, however, I’m seeing the burger to the right of the main nav on load. Any way to get rid of that and only have the burger appear on scroll? So close!

    #990592

    Hi,

    It’s fixed now. Please remove the browser cache prior to checking the page.

    Best regards,
    Ismael

    #990846

    Thanks again Ismael –
    The menu on load and scroll looks great, however, the flyout burger menu is not rendering properly and is blank on click. What do you recommend for this fix?
    Much appreciated,
    T

    #991363

    Hi,

    My bad. I added this css code to unhide the mobile menu items.

    .hide_menu_show_burger.av-active-burger-items { 
      display:  block !important;
    }

    Best regards,
    Ismael

    #992091

    Don’t be silly! All GOOD! Thanks for taking the time to solve this menu request. Everything is rendering just fine on my end.
    Thanks again.
    All my best,
    T

    #992246

    Hi T,

    Great, glad you got it working. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #994005

    Yes, this topic may be closed. Your team is wonderful. Thanks so much Rikard!

    #994011

    Hi,

    Glad Ismael could help! :)

    For your information, you can take a look at Enfold documentation here – https://kriesi.at/documentation/enfold/
    If you have any other questions or issues, feel free to start a new thread under Enfold sub forum and we will gladly try to help you :)

    Best regards,
    Yigit

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Can Main Menu be replaced by Burger on Scroll?’ is closed to new replies.