Set-up
I have a Shopify webshop with a sticky header.
ONLY on mobile I DONT want a sticky header on product pages.
Current CSS
@media screen and (max-width: 768px) {
#shopify-section-header {
position: inherit;
}
}
This CSS makes header not sticky for mobile.
But applying liquid code such that,
{% if request.path contains '/products/' %}
@media screen and (max-width: 768px) {
#shopify-section-header {
position: inherit;
}
}
{% endif %}
Doesn’t do anything.
Neither does,
.template-product {
@media screen and (max-width: 768px) {
#shopify-section-header {
position: inherit;
}
}
}
as suggested here.
Question
How do I make header not sticky only on product pages?
- product pages have ‘/products/’ in the href