Smart Lightbox
Change the position of an opened lightbox to prevent unwanted z-index, fixed positioning, and transform issues.
Implement in Webflow
Apply attributes to elements on the page
Below is a list of elements and options that are used to create this Attributes functionality. Click any of them to see more details.
This element will change its position in the DOM when it is opened and closed.
When the lightbox is open - The lightbox will become a direct child of the Body. This will avoid all z-index, fixed position, and transform issues.
When the lightbox is closed - The lightbox will return to its original position on the page.
Button, Text Link, Link Block, or Div Block
This should applied to a "Open" button that opens the lightbox.
IMPORTANT: This attribute does not open the lightbox. Use Webflow Interactions to perform the action of opening the lightbox.
Button, Text Link, Link Block, or Div Block
This should be applied to an "X" or "Close" button that closes the lightbox.
IMPORTANT: This attribute does not close the lightbox. Use Webflow Interactions to perform the action of closing the lightbox.
Button, Text Link, Link Block, or Div Block
This should be applied to a button that both opens and closes the lightbox.
IMPORTANT: This attribute does not open/close the lightbox. Use Webflow Interactions to perform the action of opening/closing the lightbox.
For example, TIME_IN_MS can be set to "400" because the animation that closes the lightbox has a 400ms transition time in Webflow Interactions.
The value should be in milliseconds without "ms". For example "250".
Working examples
See this solution working live in this Webflow project.
The lightbox that has position fixed gets stuck inside the parent wrapper of the list.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
The lightbox that has position fixed works as intended because it's 'smartly' moved in the DOM. When opened, it becomes a direct child of the Body.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Frequently Asked Questions
Everything you need to know about this attributes solution.