Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1184105

    Hi

    I have tried many solutions form the support forum but none of them worked.

    Can you please help me make my site fullwidth submenus sticky on mobile?

    I really need a fast solution!

    Thank you so much in advance :)

    Rasmus

    #1184318

    Hey rasmusheil,

    Here is the code you can put in Enfold > General Styling > Quick Css,  if it does not work, put into themes/enfold/css/custom.css

    
    @media only screen and (max-width: 767px) {
        .responsive #top .av-switch-768.av-submenu-container {
            top: 170px !important;
            position: fixed !important;
        }
    }
    

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1186130

    Thank you so much Victoria!

    It helped me.

    #1186604

    Hi Rasmus,

    Great, I’m glad that Victoria could help you out. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1406918

    Dear team,
    i have the same question / issue. But the quick css code provided earlier does not work on my page.

    How can I get the submenu sticky on mobile, too?

    Thx a lot & best regards Tilman

    #1407285

    Hi,
    This solution is not working for you because your sub-menu is not at the top of your page as in this thread, so you will need some javascript to determine when the menu gets to the top of the page and then make it sticky.
    Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function mobile_sub_menu_sticky() { ?>
    <script>
    window.addEventListener('DOMContentLoaded', function() {
      (function($){
      	var width = $(window).width();
        var $stickyTop = $('#sub_menu1');
        if (width <= 767) {
        $stickyTop.waypoint(function(direction) {
          if (direction === 'down') {
             $stickyTop.addClass('sticky-top');
          }
          if (direction === 'up') {
             $stickyTop.removeClass('sticky-top');
          }
        }, {
          offset: '0%'
        });
        }
      })(jQuery);
    });
    </script>
      <?php
    }
    add_action('wp_footer', 'mobile_sub_menu_sticky');

    Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.
    Then this CSS in your Enfold Theme Options ▸ General Styling ▸ Quick CSS field:

    .sticky-top {
    	position:fixed!important;
    	top:0!important;
    	z-index:600!important;
    }

    After applying the css, please clear your browser cache and check.

    Best regards,
    Mike

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Fullwidth submenu sticky on mobile’ is closed to new replies.