• Hi.

    (on mobile devices) How I can make the menu bar stick on top of the screes while I am scrolling up and down?

    thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @kubelyan,

    Just a little warning, sticky mobile menu can cover most of the phone screen space in landscape orientation causing serious UX issue. Do you still want to do it?

    Kind Regards, Roman.

    Thread Starter MooK

    (@kubelyan)

    Hi Roman.

    I don’t think that it will cover most of the whole screen. It will keep just a menu bar with mobile menu icon on top of the screen.
    Very similar to the code provided by your colleague for Sydney theme:

    jQuery(function($) {
    
      if ( matchMedia( 'only screen and (max-width: 1024px)' ).matches ) {
    
        var headerFix = $('.site-header').offset().top;
        var vDistance = headerFix+280;
    
        var inserated = false
        $(window).on('load scroll', function() {
          var y = $(this).scrollTop();
          if ( y >= vDistance) {
    
            if(inserated == false){
              var newHead = $('#masthead').clone();
              
              (newHead).prependTo('body').addClass('masthead-clone').animate({
                top: 0
              }).resize();
    
              $('.masthead-clone .btn-menu').on('click', function() {
                  $('.masthead-clone #mainnav-mobi').slideToggle(300);
                  $(this).toggleClass('active');
              });
    
              $(document).on('click', '.masthead-clone #mainnav-mobi li .btn-submenu', function(e) {
                  $(this).toggleClass('active').next('ul').slideToggle(300);
                  e.stopImmediatePropagation()
              });          
              
              inserated = true;
              
            }    
            
          } else {
          
            $('.masthead-clone').animate({
              top: -200
            }).remove();
            inserated = false;
            
          }
    
        });
      
      }
    
    });

    Hello,

    It looks like this issue requires some coding and testing on different screen resolutions, you can hire someone for this kind of service.

    Kind Regards, Roman.

    Thread Starter MooK

    (@kubelyan)

    Ok Roman.

    I will do it by myself.
    But please, could you look into issue with jumping banner part when you first start scrolling the page on mobile screen.
    It will be easier for me to do the rest, If you will fix the bug first.

    Thanks

    Hello, I’m not sure what jumping bug you mean.

    Can you please create a new topic for this issue with more details?

    Kind Regards, Roman.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sticky Mobile Menu’ is closed to new replies.