Struggling to find a solution for implementing a sticky header on our mobile Shopify site that shrinks the header logo when scrolling down and returns it to its original size at the top. If this also reduces the entire header size, that would be fine!
Previously attempted code caused issues with the logo not resizing properly when scrolling back up, resulting in strange behavior on different pages.
$(window).scroll(function(){
if ($(this).scrollTop() > 10){
$('.site-header__logo-image img').addClass("manage_width");
}
else{
//revert to default styles
$('.site-header__logo-image img').removeClass("manage_width");
}
});
Various attempts using JS, CSS, and HTML have failed to yield results. Any assistance with code specifically designed for mobile application would be greatly appreciated! Thank you!!