Webflow sync, pageviews & more.
NEW

How can I hide the "no items found" empty field in Webflow for a second multi-image gallery on certain pages?

TL;DR
  • Use Conditional Visibility and CMS fields to show the second gallery only when images exist or a toggle is true.
  • Alternatively, hide the empty state using a custom script targeting the second gallery’s unique class or ID.

To hide the "No items found" empty state in Webflow for a second multi-image gallery on specific pages, you’ll need to use a conditional visibility setting or custom script depending on your page logic.

1. Use Conditional Visibility for CMS Collection Lists

  • Select the Collection List Wrapper of your second gallery inside the Designer.
  • In the Element Settings panel, set Conditional Visibility.
  • Add a condition like: “Gallery field is set”, assuming you have a multi-image CMS field.
  • This ensures the empty state only shows if the gallery images truly don’t exist.

2. Use Page-Specific Conditional Logic (Collection Pages)

  • For CMS Collection Pages:
  • Use a unique CMS field (like a true/false toggle or category reference) to control which pages show the second gallery.
  • Set Conditional Visibility on the Collection List Wrapper, Empty State, or any parent div based on that field.
  • For example: Show only if “Show Second Gallery” is true.

3. Hide "No Items Found" with Custom Script (Fallback)

If Conditional Visibility isn’t flexible enough, add custom JavaScript in the Page Settings > Custom Code > Footer section:

  • Use this pattern (no <script> tags here per rules):

    if (document.querySelector('.second-gallery .w-dyn-empty')) { document.querySelector('.second-gallery .w-dyn-empty').style.display = 'none'; }

  • Replace .second-gallery with your actual class name or use #gallery-id if using unique IDs.

  • This hides the “No items found” block only when it appears in that specific gallery section.

  • Assign a distinct class to the second gallery’s Collection List and empty state.
  • This ensures you’re only targeting that one instance when applying conditional settings or styling.

Summary

Use Conditional Visibility based on CMS fields to control when the "No items found" message appears, or hide it with custom script targeting the second gallery only. Ensure elements have unique classes for precise control.

Rate this answer

Other Webflow Questions