A user is experiencing a loading delay with a custom Liquid form embedded on their Shopify page and wants to add a section-specific preloader/spinner to improve user experience during this delay.
Solutions Proposed:
MandasaTech’s approach: Wrap the form in a container div, add CSS to style a loading message, and use JavaScript with DOMContentLoaded to hide the loader after the form loads (using either a timeout or event listeners).
tim_1’s solution: Provided ready-to-use code (markup not visible in text) to be added at the bottom of the Custom Liquid section, with a visual demonstration (GIF) showing the spinner in action.
Implementation:
Both solutions recommend placing the code at the bottom of the existing Custom Liquid section. The user requested complete code placement instructions from MandasaTech.
Status: The discussion appears ongoing, with the user seeking clarification on exact code placement.
Summarized with AI on October 28.
AI used: claude-sonnet-4-5-20250929.
On my website, I’ve embedded a form using custom Liquid code. When visiting the page, there is a slight loading delay for that section. I’d like to implement a spinner (preloader) specifically for the form section to improve user experience during this loading time.
Is it possible to create a preloader that only affects this section, rather than the entire page?
Use JavaScript to hide the loader once the form loads:
<script>
document.addEventListener("DOMContentLoaded", function () {
const formWrapper = document.getElementById("form-wrapper");
// Adjust this based on when your form finishes loading (e.g., iframe load, ajax complete, etc.)
setTimeout(() => {
formWrapper.classList.add("form-loaded");
}, 1000); // You can use actual event listeners if applicable
});
</script>
This way, the spinner only affects your form area and improves the UX during that short load time.
Let me know if you need help tailoring it to your exact code. Happy to help further!