To create a click-to-enlarge image effect with a dark overlay on a Webflow portfolio template page, you'll need to combine interactions, a lightbox-style modal, and hidden div elements. Here’s how:
preview-image-wrapper
.On the template page, add a new div block outside your main content (preferably at the end of the Body).
Set its class to something like image-modal
.
Style it with:
Position: Fixed (Full screen)
Background: Black with 70–90% opacity rgba(0,0,0,0.8)
Z-index: Higher than the rest of your content (e.g., 9999)
Display: Set to None
initially
Flex display: Centered (justify: center, align: center) to center the image
Inside the modal, add an Image element and give it a class like modal-image
.
Optionally, add a close button (a simple text “X” or an icon) in a corner of the modal.
Select the preview image and go to Interactions (IX2).
Create a new Mouse Click (Tap) interaction:
On First Click:
image-modal
display to Flex
(or block)Select the modal-image
(or even better, set it dynamically depending on the image clicked):
You can either:
image-modal
background:Display: None
To let users click an image to enlarge it with a dark screen behind:
This method mimics a lightbox effect entirely within Webflow, without any third-party code.