Our shop section is coming soon, watch for updates! Shop now
Guide

CMS Lightbox

The lack of CMS support for the lightbox feature has been somewhat annoying, however today I have worked out a fully-functional solution!
January 5, 2019

As I update this every so often, you may want to the live example for the latest changes. You can either view the final result 1.1k or looks at it in the designer (share link) 458 for those who want to look a bit deeper into it.

The lack of CMS support for the lightbox feature has been somewhat annoying, however today I have worked out a fully-functional solution! All it takes is a simple HTML embed and you'll have a functioning lighbox that updates with your CMS collection.

Step 1: Create a dynamic list
Step 2: Connect if to your desired CMS collection
Step 3: Insert the HTML embed into the dynamic item
(gallery-container and gallery-item are just my style names for my gallery)

Step 4: Add the HTML Code:
Full text available to copy at the bottom of this post.

CMS-lightbox.jpg815x629 67 KB

To get this code I created a standard lightbox as a test and then copied the code from Chrome's Inspector. I removed a couple of the script codes for width and height that would screw up some of my other images, and I added dynamic fields for the image's url I wanted.

THUMBNAIL IMAGE - I used the same image from my thumbnail and full shot while I was testing this, but in proper implementation of this I would make a thumbnail image in my collection template, and set that in the <img src="">

Lightbox Group - you can also specify a lightbox group to link them all together. I didn't in this version, but you would just replace the "photo-gallery" with a dynamic field, or you can just leave it as this if you only have one lightbox on your page.

Step 5: Save and close.
The published website should now have a functioning photo gallery!

HTML TEXT

<a class="w-inline-block w-lightbox" href="#">
 <img src="(image-thumbnail-field)" />
 <script class="w-json" type="application/json">
   {
     "group": "(your-group-name)", "items": [{
       "_id": "57e0683ebfc7a6d0523235b2",
       "cdnUrl": "(image-field)",
      "type": "image",
      "url": "(image-field)"
     }]
   }
 </script>
</a>

I hope this helps some people!


Oramsdesign
Details
CMS Lightbox
The lack of CMS support for the lightbox feature has been somewhat annoying, however today I have worked out a fully-functional solution!
Preview ProjectClone Project

Discussion

Other Guides

Guide
Authentication
Jason Dark
Guide
Guide: Simple Back
Tom Bekkers
News, Updates & Clonables

Join the newsletter for updates

Join 600+ webflow community members.
Welcome to the club. Cool stuff coming your way.
Oops! Something went wrong while submitting the form.