Sticky header problem

Highlighted
Excursionist
35 4 2

Hello,

I was using this tutorial: https://community.shopify.com/c/Shopify-Design/Sticky-header-that-auto-hides-when-scrolling-down-for...

the sticky header is working fine.

I run into another problem though: when I click the menu or the search icon I get pushed back to the top of the page

I went into theme.js and disabled the code  "window.scrollTo(0, 0);" by adding //window.scrollTo(0, 0);

now when I click the menu it is working fine and letting me stay at the page, but when I click the search icon I just see this on desktop and mobile: https://gyazo.com/ba97b05db3f6650bc8c88327bd5c843d

I think the search bar is showing at the top of the page where I cant see it.

I also tried to remove the search icon by adding this code to the header.liquid

<style>
  .icon-search{
    display: none !important;
  }
</style>

but it makes the sticky header not work anymore. 

Is there anyway to fix this?

 

Thanks alot 

0 Likes