Is there a way to stop sticky header until Image Banner?

Is there a way to stop sticky header until Image Banner?

randytheasian
Explorer
115 0 23
Replies 5 (5)
randytheasian
Explorer
115 0 23

Is there a code I can copy?

Guleria
Shopify Partner
3944 791 1122

Hello @randytheasian ,

 

Yes possible but not possible to provide instructions for it as it needs multiple changes.

If you are looking for an idea please follow:

1) Disable the default sticky feature.

2) Write JS which will add a fixed class to the header when it reaches a second second or specific position.

3) Assign css to the class which we added in step 2nd.

In this way the header will work as you need.

 


Problem solved don't forget to Like it and Mark it as Solution!
If you need help to implement it you can contact me for services

You can find the email in the signature below.

 

Regards
Guleria

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
randytheasian
Explorer
115 0 23

Great, could you provide me the codes?

PageFly-Kate
Shopify Partner
1344 371 412

Hi @randytheasian

This is Kate from PageFly - Landing Page Builder App.

 

You can try this code by following these steps:

  • Step 1: Go to Online Store->Theme->Edit code.
  • Step 2: Search file theme.liquid
  • Step 3: paste bellow code in tag </body> -> save.

 

<script>
var elementToHide = document.querySelector('[data-sticky-type="reduce-logo-size"]'); 
var targetElement = document.getElementById("shopify-section-template--18249715876071__featured_collection_dExk9t");

window.onscroll = function () {
  const targetRect = targetElement.getBoundingClientRect();
  if (targetRect.top <= window.innerHeight / 2 && targetRect.bottom > 0) {
    elementToHide.style.display = 'block';
  } else {
    elementToHide.style.display = 'none';
  }
};
</script>

 

 

Hope that my solution works for you.

Best regards,
Kate | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


Unlock the secrets to a record-breaking BFCM with PageFly and Canva


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)


➜ Weekly updated Shopify tutorials on YouTube


All features are available from the Free plan. Live Chat Support is available 24/7.


randytheasian
Explorer
115 0 23

Thanks for responding. Unfortunately, the slideshow banner is overlay the header and it doesn't stop before the banner. Any solution?