Shopify/Timber

Sticky header and mobile drawers not cooperating.

Opened this issue · 2 comments

Hi all,

I've been using sticky.js on my navigation bar on the Timber theme. However, it doesn't work well on mobile as it doesn't stick and the navigation bar sometimes shows up with some padding at the top. Furthermore, it doesn't cooperate well with the drawer as the position changes back to the top after opening.

Anyone have any solutions?

Do you want the navbar to stick when as soon as your scroll down? The plug-in is probably causing some issues.

If you're using jQuery, use this:

NB change the 85 to the height of your navbar.

$(window).scroll(function() {
    var scroll = $(window).scrollTop();            

    if (scroll >= 85) {        
      $(".navbar").addClass("scrolled");            
    } else {
      $(".navbar").removeClass("scrolled");      
    }
});

This isn't related to the framework so am closing this issue. Feel free to continue the discussion here or in our forums.