Webflow sync, pageviews & more.
NEW

Can you provide assistance with creating a modal view for glossary terms on my Webflow site using CMS collection content?

TL;DR
  • Create a CMS Glossary collection and add a Collection List with "Learn More" buttons carrying custom attributes for term and definition.
  • Build a hidden modal outside the Collection List and use JavaScript to populate and display the modal with clicked CMS data.

To create a modal view for glossary terms using CMS collection content in Webflow, you can use a combination of Collection Lists, interactions, and hidden modal elements.

1. Create Your CMS Collection

  • Go to CMS > Collections and add a Glossary collection.
  • Add fields such as Term (Plain Text) and Definition (Rich Text or Plain Text).

2. Add a Collection List to the Page

  • Drag a Collection List element onto your page.
  • Bind it to your Glossary collection.
  • Inside each item, add:
  • A Text Block for the Term.
  • A Button or Link Block named "Learn More" (or similar) to trigger the modal.

3. Create the Modal Structure (Once Per Page)

  • Outside the Collection List, create a Div Block and name it something like Modal Wrapper.
  • Set it to Display: None, Fixed Position, and cover the full viewport (top: 0, left: 0, width: 100%, height: 100%), with a semi-transparent dark background.
  • Inside that, add another Div Block for the Modal Content. Style it as you like: centered, scrollable, white background, etc.
  • Add two elements in the modal:
  • A Text Block for the Term.
  • A Rich Text or Text Block for the Definition.
  • An X icon or button to close the modal.

4. Add Custom Attributes to Pass CMS Data

Webflow doesn’t natively support dynamic modals for each CMS item, so use custom attributes to pass CMS data:

  • In each Collection Item, on your "Learn More" button/link:
  • Add two custom attributes:
    • data-term = Add Field > Term
    • data-definition = Add Field > Definition

5. Add Page Interactions

  • Go to Page Interactions and create a new interaction (on the button):
  • Trigger: Mouse Click (on the Learn More button).
  • Action: Show the modal wrapper (Change display from "None" to "Flex" or "Block", and animate opacity if needed).
  • Since Webflow doesn't dynamically bind custom attributes in interactions, you’ll need custom JavaScript to populate the modal content.

6. Embed Custom Code

  • Use an Embed element or the Page Settings > Custom Code (Before ) to include this JavaScript:
<script>  document.querySelectorAll('[data-term]').forEach(btn => {    btn.addEventListener('click', function() {      const term = this.getAttribute('data-term');      const definition = this.getAttribute('data-definition');      document.querySelector('#modal-term').textContent = term;      document.querySelector('#modal-definition').textContent = definition;      document.querySelector('#modal-wrapper').style.display = 'flex';    });  });  document.querySelector('#modal-close').addEventListener('click', function() {    document.querySelector('#modal-wrapper').style.display = 'none';  });</script>
  • Make sure the modal term, definition, and close button have the correct IDs:
  • #modal-wrapper
  • #modal-term
  • #modal-definition
  • #modal-close

Summary

To show CMS glossary terms in a modal:

  • Build your glossary with a CMS collection.
  • Add a Collection List and embed "Learn More" buttons with custom attributes.
  • Create a reusable modal structure outside the Collection List.
  • Use JavaScript to dynamically populate the modal and control visibility.

This setup creates an efficient, scalable modal interface powered by your Webflow CMS.

Rate this answer

Other Webflow Questions