Shopify themes, liquid, logos, and UX
for reference: petalsandpeacocks.com
I already have the code thanks to google gemini.
// Get a reference to the logo element const logo = document.getElementById("logo"); // Function to handle the scroll event and rotate the logo function handleScroll() { // Get the current scroll position const scrollPosition = window.pageYOffset; // Get the total document height and viewport height const docHeight = document.documentElement.scrollHeight; const viewportHeight = window.innerHeight; // Calculate the rotation angle based on scroll position const rotationAngle = (scrollPosition / (docHeight - viewportHeight)) * 360; // Apply the rotation transformation to the logo logo.style.transform = `rotate(${rotationAngle}deg)`; } // Add a scroll event listener to the window window.addEventListener("scroll", handleScroll);
This method involves editing your Shopify theme files directly. Here's how to do it:
<script> // Paste your JavaScript code for the spinning logo here </script>
So now I just need to be able to give my logo element a unique ID but this is where I get stuck.
Any help is much appreciated
Hi @ferverco,
May I suggest to update code these steps:
1. Go to Store Online-> theme -> edit code
2. Sections/header.liquid
3. find "header__heading-logo motion-reduce"
4. Add "id: 'logo'," likes the screenshot below
If petalsandpeacocks.com is your store. You only need replace code
From
const logo = document.getElementById("logo");
To
const logo = document.getElementById("rotate3D");
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025