Jump to content

Text Link for Size Guide to open a Lightbox

Go to solution Solved by BlayneG87,

Recommended Posts

Hello!  I've already tried to research this topic on Google and through the Squarespace Forum...I haven't found the exact solution I'm looking for so initiating a new post.

I'm doing a website for a clothing company and they want their size guide to be available in the product page.  They want people to be able to click on Size Guide (text link) and it open a lightbox to each products size chart.

How do I do this without using a plugin?  Or if I have to use a plugin, are there any that are free?

Thank you!
Blayne

Link to comment
1 hour ago, BlayneG87 said:

Hello!  I've already tried to research this topic on Google and through the Squarespace Forum...I haven't found the exact solution I'm looking for so initiating a new post.

I'm doing a website for a clothing company and they want their size guide to be available in the product page.  They want people to be able to click on Size Guide (text link) and it open a lightbox to each products size chart.

How do I do this without using a plugin?  Or if I have to use a plugin, are there any that are free?

Thank you!
Blayne

A paid plugin may have everything you need to set up everything quickly, but incase you want a simply free alternative, follow these steps

1. Upload the size chart image to Asset library

2. Grab the image URL and replace it in the given code below

<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/shoelace.js"></script>

<sl-dialog label="Size Chart" class="size-chart-dialog" style="--width: 50vw; --sl-panel-background-color: #fff; --sl-overlay-background-color: #fff9; --sl-spacing-large: 1em;">
  <img src="https://bodyandsoul.mu/media/size_chart/menwebcom.jpg"/>
</sl-dialog>

<a class="size-chart-trigger">📐 Size chart</a>

<script>
  const dialog = document.querySelector('.size-chart-dialog');
  const openButton = document.querySelector('.size-chart-trigger');
  const closeButton = dialog.querySelector('sl-button[slot="footer"]');

  openButton.addEventListener('click', () => dialog.show());
  closeButton.addEventListener('click', () => dialog.hide());
</script>

3. Replace the image URL with your actual size chart (place it inside double quotes)image.thumb.png.bd1dbe085de745b925249d983e52af61.png

Your size chart will be like, the dialog feature from Shoelace https://shoelace.style/components/dialog/

image.thumb.png.f42bdef83bb9019e80e625fd8bed5bb1.png

Edited by Beyondspace

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment
2 minutes ago, BlayneG87 said:

Hi Beyondspace - thanks for these instructions.  I'm trying it at the moment.  Where are you adding the code?

Thanks!

 

Open a code block and insert it

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment
On 8/28/2024 at 11:42 PM, BlayneG87 said:

Thank you, it is working but it is hiding behind my store image for some reason.  Is there any way to also change the text size of "size guide" to match my other Text?

Screenshot 2024-08-28 at 9.39.44 AM.png

Screenshot 2024-08-28 at 9.42.10 AM.png

Can you share link to this product? We can check easier

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.