To make your CMS Collections in Webflow open a popup to view details instead of loading a separate page, you can use custom code and some interactions in Webflow. Here's a step-by-step guide to help you achieve this:
1. Set up your CMS Collection: First, create a CMS Collection in the Webflow Designer and add the necessary fields for the details you want to display in the popup. Make sure you have a Collection List or Collection Page that displays these items.
2. Design your popup: Design the popup using a div block or a modal element in Webflow. Customize its appearance, layout, and content to match your desired design.
3. Add interactions: Choose the element that triggers the popup, such as a button or a link, and add an interaction to it. You can do this by selecting the element, going to the Interactions panel, and clicking on the plus icon to create a new interaction.
4. Create the interaction: In the interaction panel, set the trigger to the element click. Then, create two actions: one to open the popup and another to close it.
5. Open popup action: For the action that opens the popup, choose "Affect different element" and select the popup element you created earlier. Set the action to "Display: Block" or "Opacity: 100%" to make it visible.
6. Close popup action: For the action that closes the popup, again choose "Affect different element" and select the popup element. This time, set the action to "Display: None" or "Opacity: 0%" to hide the popup.
7. Pass data to the popup: To display the relevant data in the popup, you need to use custom code. In the Designer, select the dynamic element in the popup that corresponds to the data field you'd like to display. Give it a unique class name, and then export your site for custom code editing.
8. Edit the custom code: Open the exported code and locate the JS file associated with the page where the popup is triggered. In that file, find the interaction that opens the popup and add a line of code to pass the relevant data to the popup element. You can achieve this by using JavaScript/jQuery to dynamically update the content of the popup based on the clicked CMS item.
For example, if you have a CMS Collection named "Products" and a field named "Product Name" in your popup, the code might look something like this:
```
$('.popup-product-name').text('{{Product Name}}');
```
Make sure to replace `.popup-product-name` with the appropriate class name you assigned to the element in the Designer.
9. Save and publish: After editing the custom code, save the changes to the JS file, and then publish your site.
By following these steps, you should be able to create a popup that opens when a user clicks on an item in your CMS Collection, and dynamically display the details from that item within the popup.