Sticky/Fixed Header and Navigation for Debut Theme

Topic summary

Implementation of Sticky Header for Debut Theme

This thread provides a tutorial for adding a sticky/fixed header to Shopify’s Debut theme, with two options:

  • Option 1: Makes the entire header (including announcement bar) sticky
  • Option 2: Makes only the navigation sticky, allowing the announcement bar to scroll away

Both require adding CSS code to theme.scss.liquid and JavaScript to theme.js.

Common Issues Reported:

  • Content hidden behind header: The header covers page content instead of pushing it down. Users resolve this by adjusting padding values (typically changing from 80px to higher values like 107px, 130px, or 200px depending on header height)
  • Page jumping/loading glitch: Content briefly appears behind the header on page load before repositioning correctly
  • Mobile menu malfunction: After scrolling, dropdown menus don’t display properly
  • Search/cart overlay problems: Search drawer and cart don’t appear correctly when header is sticky
  • Gap above sticky header: Empty space appears between top of viewport and header when scrolling

Alternative Solutions:

Several users offer modified code snippets and workarounds. One contributor promotes a free professional solution via external link.

Status: The discussion remains ongoing with unresolved issues for many users, particularly around the content overlap and page-load animation problems. The tutorial is unsupported by Shopify and specific to unmodified Debut theme.

Summarized with AI on November 8. AI used: claude-sonnet-4-5-20250929.

I am using Minimal theme and the code above did not seem to work properly for me, although I do see that it works well on the sample site provided. So take that as you will. I also prefer the slight drop shadow that Sean’s original code gives to the header, so I wanted to find a way to make the original code work with my theme.

Here is a solution I came up for Sean’s / Shopify’s sticky header code that works on my site. I’m not a professional developer, so buyer beware.

  1. In the theme.js code, replace
$('#PageContainer').css('padding-top', $headerHeight);

with

$('.main-content').css('padding-top', $headerHeight);
  1. In timber.scss.liquid, locate
.main-content {
  display: block;
  margin-top: $gutter * 2;
  padding-bottom: $gutter * 2;
}

and add a line for padding-top with some hard-coded placeholder pixels

.main-content {
  display: block;
  margin-top: $gutter * 2;
  padding-bottom: $gutter * 2;
 **padding-top: 180px;**
}

Mess around with the “180px” number to find a padding that works for your site/header. This is just a placeholder to make sure the content loads immediately some place below the header before the javascript has a chance to kick in and calculate the actual padding required by your specific header. Before I added this second step, the site would immediately load with content behind the header and then after a second or two the content would be pushed down to the correct position. By making both these changes, the content will load in a way that is not disruptive to the user. I’m assuming it’s not good to have such a hard-coded pixel value for padding-top, so this is a hybrid solution that holds the page content in roughly the right place while javascript comes up behind and changes it into a more precise number in the spirit of adaptivity.

Again, I’m not a professional developer and maybe a professional developer can offer some advice or improvements. But so far this is working well for me on both desktop and mobile.

3 Likes