Shopify themes, liquid, logos, and UX
I want to link a button on my page to a pop-up form for our visitors to fill in. How can I do that?
I currently use the forms app on Shopify.
Hi,
Can you let us know which page do you want the form to link
I want the button to link to a form. And I want that form to collect emails.
HI,
Are you using any apps to create forms or you need to code to create the popup and form
I currently use the forms app on Shopify.
Hi @albaq ,
You can try this way:
Step 1: Hide your form by adding the following code to the file (theme.css, global.css, ...)
.your_form{ display:none; }
Step 2: Add this code to your js (global.js or theme.js, ..)
const btn = document.querySelector(".your_button"); const form = document.querySelector(".your_form"); const close_form = document.querySelector(".your_close_form"); if(btn){ btn.addEventListener("click" ,() => { form.classList.add("active"); }) } if(close_form){ close_form.addEventListener("click" ,() => { form.classList.remove("active"); }) }
Step 3: Add the following code into the css file (theme.css, global.css,...) to display the form after clicking the button
.active{ display:block!important; }
Hope it helps @albaq !
If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
For B2B solutions and custom pricing, check out B2B Solution & Custom Pricing |
For adding product labels/badges, visit Product Labels by BSS
BSS Commerce - Shopify Apps & Store Development Service Provider
Hire a Shopify expert | Shopify Plus Store Development
User | RANK |
---|---|
229 | |
165 | |
66 | |
55 | |
49 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023