Boost Your Shopify Homepage: Dynamically Hide Floating App Icons Over Your Hero Video

Hey everyone! As a Shopify migration expert and someone who spends a lot of time digging through the community forums, I often see recurring frustrations that store owners face. One particular issue that popped up recently, and frankly, it's a super common one, is how to deal with those persistent floating app icons that sometimes just refuse to get out of the way of your beautiful hero section. You know the ones – your chat widget, loyalty program button, review prompts, or even music players. They're great for functionality, but they can really clutter your homepage's crucial first impression.

I recently followed a thread started by a store owner named yonicque, who was running into this exact problem. They had a stunning video hero on their homepage, but these app icons (specifically Google, Rewards, Chat, Signup, and Music icons) were obscuring it on both mobile and desktop. The goal was clear: hide them when the video hero was prominently displayed at the top of the page, and then let them reappear once the customer scrolled down. It's a fantastic idea for a cleaner user experience, isn't it?

The Annoying Overlap: Why It Happens and Why It Matters

Most Shopify apps are designed to be ever-present and easily accessible, which is usually a good thing. They inject their elements (like chat bubbles or reward buttons) directly into your site's HTML, often with a fixed position so they "float" as you scroll. While this ensures visibility, it can become a real headache when these elements overlap with your most impactful content – your hero section. Your hero video or banner is your storefront's main attraction, designed to grab attention and convey your brand's essence immediately. Having a chat bubble covering part of your product or a rewards icon hiding your call to action? That's a definite no-go for conversion and brand perception.

The Community Solution: A Clever Custom Code Snippet

Thankfully, our amazing community is always ready to jump in with practical solutions. A user named tim_tairli stepped up with a brilliant piece of custom code that tackles this issue head-on. The solution uses a combination of CSS and JavaScript to dynamically hide those pesky icons when your page is at the very top (and your hero is fully visible) and then gracefully fade them back in as you scroll down. It's a smart way to ensure your hero section gets the unobstructed attention it deserves.

How This Dynamic Hiding Works Under the Hood

Let's break down what tim_tairli's code does:

  • CSS for the Magic: The CSS part of the code targets specific IDs and classes common to many floating app widgets, such as #smile-ui-lite-container (for loyalty programs), #shopify-chat, [class*=kl-teaser] (for certain signup forms like Klaviyo), #trustedsite-tm-image, and .jdgm-revs-tab-btn (for review apps). It applies a smooth transition and, crucially, sets their opacity to 0 and pointer-events to none when a special attribute, header-visible="true", is present on the element.
  • JavaScript for Detection: The JavaScript uses an IntersectionObserver – a modern browser API – to detect when your site's main header section is visible within the viewport. When the header is visible (meaning you're at the top of the page), it adds the header-visible="true" attribute to the tag. When the header scrolls out of view, this attribute is removed. This dynamic attribute then triggers the CSS to hide or show your icons.

Step-by-Step: Implementing the Code on Your Shopify Store

Here's how you can implement this solution on your own Shopify store, keeping in mind a crucial detail that came up in the discussion about specific themes like "Motion."

Important Note: The placement of this code can vary slightly depending on your theme. While many themes offer a "Custom liquid" section, some, like the "Motion" theme, might require a different approach. The community discussion highlighted that for the Motion theme, you'd need to use a "Custom content" section with an "HTML" block inside it.

  1. Access Your Theme Editor:
    • From your Shopify admin, go to Online Store > Themes.
    • Find your current theme and click Customize.
  2. Navigate to Your Homepage Template:
    • In the theme editor, ensure you are editing the Homepage template.
  3. Add a New Section for the Code:
    • Scroll down to the bottom of your homepage template in the left sidebar and click + Add section.
    • For most themes (with "Custom liquid"): Search for and select Custom liquid.
    • For themes like "Motion" (without "Custom liquid"): Search for and select Custom content. Then, once added, click on the new "Custom content" section, remove any default blocks (like "Text"), and click + Add block, then choose HTML. This was the "lifesaver" clarification that tim_tairli provided to yonicque!

    Here's a visual of what that "Custom content" with "HTML" block looks like for Motion theme users:

    Screenshot showing 'Custom content' section with 'HTML' block selected in Shopify theme editor
  4. Paste the Code:
    • In the "Custom liquid" field (or the "HTML" block), paste the following code exactly as it appears:
    
    
  5. Save and Test:
    • Click Save in the top right corner of the theme editor.
    • Visit your live homepage and test the functionality. Scroll up and down to see the icons gracefully appear and disappear.

Here are the visuals provided by tim_tairli showing the effect:

At the top / Scrolled

Screenshot of Shopify homepage with floating icons visible at the top / Screenshot of Shopify homepage with floating icons hidden after scrolling down

A Few Important Considerations

  • Homepage Specific: This code is designed to work specifically on your homepage, as the section is added to the homepage template. If you need similar functionality on other pages, you might need to adapt the approach.
  • Targeting More Elements: The provided code targets several common app elements. If you have other floating icons that aren't being hidden, you'll need to inspect your live website using your browser's developer tools to find their unique IDs or classes. Once you have them, simply add them to the CSS selector list within the :is(...) pseudo-class.
  • Theme Updates: Be mindful that major theme updates could potentially affect custom code. It's always a good idea to keep a backup of your theme and re-test after any significant updates.

It's these kinds of practical, community-driven solutions that make the Shopify ecosystem so powerful. By taking a few extra steps to implement custom code like this, you can significantly enhance your customers' first impression, ensuring your brand's message and visuals shine through without unwanted clutter. A huge shoutout to tim_tairli for sharing this fantastic fix with the community and helping store owners like yonicque create a more polished and professional online presence!

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools