# CMS Request: Dynamic Popups

Source: https://support.wix.com/en/article/cms-request-dynamic-lightboxes (updated 2026-11-10)
Status: feature request, collecting votes
Related: Wix developer documentation, https://dev.wix.com/docs/llms.txt; Help Center index, https://support.wix.com/en/llms.txt

Currently, it is not possible to make popups dynamic by connecting them to CMS collections. However, you can connect a popup's attached elements to CMS collection content to make the elements dynamic (e.g. text, images, buttons).

We are always working to update and improve our products, and your feedback is greatly appreciated.

---

### Workaround

Using Velo, you can create a popup that opens from a dynamic item page and displays the same item as shown on the page that the popup was opened from.

  
 For example, if you have dynamic item pages that display the services you offer, you could link a button on the page to a popup. In the popup, you could connect elements like text, images, and buttons to a dataset that connects to the same collection. As a result, when visitors click the button on your dynamic item page, a popup opens with more info about the same item displayed on the page.

> **Before you begin:** Make sure your site has the following: 
>
> * [A popup](https://support.wix.com/en/article/wix-editor-adding-and-setting-up-a-lightbox).
> * A [dynamic item page](https://support.wix.com/en/article/cms-about-dynamic-pages#dynamic-item-pages) with a button that links to the popup.
> * [Collection fields](https://support.wix.com/en/article/cms-formerly-content-manager-adding-a-field-to-a-collection) for the content that will appear in the popup elements.

**Wix Editor:**

1. [Go to your editor](https://manage.wix.com/account/site-selector/?actionUrl=https%3A%2F%2Fwww.wix.com%2Feditor%2F%7BmetaSiteId%7D%3FeditorSessionId%3D%7Besi%7D%26).
2. Go to relevant dynamic item page.
3. Enable Velo Dev Mode:  
   1. Click **Dev Mode** at the top of the editor.  
   2. Click **Turn on Dev Mode**.
4. Copy the code snippet below and paste it at the top of your page code:

```javascript
import wixWindowFrontend from 'wix-window-frontend';
```

![A screenshot of adding a code snippet to the top of a dynamic item page's code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/43e36940-90a7-456e-9bdb-a1a28aeafe46/3c14f1ee-73a9-4511-ae39-2da32bb7a697.png)

1. Copy the code snippet below and paste it after: **$w.onReady(function () {**

```javascript
$w('#openLightbox').onClick(async () => {
        const item = await $w('#dynamicDataset').getCurrentItem();
        const id = item._id;
        wixWindowFrontend.openLightbox("Dynamic Lightbox", id);
    })
```

![A screenshot of pasting the second snippet of code in the dynamic item page's code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/baa71c33-2bb5-4b6a-9690-4d612b35bc0b/a3fe6cd8-e912-4430-a8b4-c62fa33dcf07.png)

1. In the sample code you pasted, replace the IDs listed below with those used by your site:  
   * **openLightbox:** Replace with the ID of the button that opens the popup.  
   * **dynamic Dataset:** Replace with the ID of the dynamic item page dataset.  
   * **Dynamic Lightbox:** Replace with the name of the popup.

![A screenshot showing the IDs and lightbox name that needs to be replaced in the code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/fdb65ab7-6ff3-4f63-905e-823b84e1fa32/da8227db-74d9-4688-8e8b-ec526a493722.png)

1. In your editor, go to the popup.
2. Add a dataset and connect it to the same collection as your dynamic item page:  
   1. Click **CMS** ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/f0656688-8ed1-488a-888d-62373b7c3a3c/2021/07/13/be1f7f18-9356-4c33-b010-192982c912e9/59fd7aba-c990-4d61-ab3d-ad7d2e1cce16.png) on the left side of the editor.  
   2. Click **Add Content Elements**.  
   3. Click **Dataset.**  
   4. Click the **Choose a collection** drop-down and select the same collection that connects to your dynamic item page.  
   5. Click **Create**.
3. Click the **Items per load** field in the dataset settings and type the number **1**.
4. Connect the elements in your popup (e.g. text, images, buttons) to the dataset:  
   1. Click the relevant element on the popup.  
   2. Click the **Connect to CMS** icon ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2023/06/16/2d484f5d-e1bf-4d48-9e42-82216e8b88de/08e74518-edad-42f8-b007-c974ba767eb6.png).  
   3. Click the dropdowns under **Connections** and select the relevant collection fields or dataset actions.  
   4. Repeat these steps for each element on your popup that you want to connect.
5. Copy the code snippet below and past it at the top of your popup code:

```javascript
import wixWindowFrontend from 'wix-window-frontend';
import wixData from 'wix-data';
```

![A screenshot of pasting the code snippet to the top of the lightbox code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/7b77ff94-f5af-4681-a759-7bb6a5b003cb/446cb13e-355a-4776-82d5-f9eebbe4f2fc.png)

1. Copy the code snippet below and paste it after: **$w.onReady(function () {**

```javascript
const getData = async () => {
       const id = await wixWindowFrontend.lightbox.getContext();
       $w('#dataset1').setFilter(wixData.filter().eq('_id', id));
}
getData();
```

![A screenshot of adding the code snippet above to the lightbox code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/b26421b6-7cae-4816-aca6-6dfef9c672eb/0834cfac-a7a9-491a-ac34-423c61044204.png)

1. In the sample code you pasted, replace **dataset1** with the ID of your popup dataset.
2. Preview your site to test the functionality.
3. When ready, publish your site.

**Studio Editor:**

1. [Go to your editor](https://manage.wix.com/account/site-selector/?actionUrl=https%3A%2F%2Fwww.wix.com%2Feditor%2F%7BmetaSiteId%7D%3FeditorSessionId%3D%7Besi%7D%26).
2. Go to relevant dynamic item page.
3. Click the **Code** icon ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2023/12/12/6d8f2756-fab1-4911-98b5-d66edf68818e/ea744f9b-2177-476f-a151-18e6116c7884.png) on the left.
4. (If necessary) Click **Start Coding**.
5. Copy the code snippet below and paste it at the top of your page code:

```javascript
import wixWindowFrontend from 'wix-window-frontend';
```

![A screenshot of adding a code snippet to the top of a dynamic item page's code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/43e36940-90a7-456e-9bdb-a1a28aeafe46/3c14f1ee-73a9-4511-ae39-2da32bb7a697.png)

1. Copy the code snippet below and paste it after: **$w.onReady(function () {**

```javascript
$w('#openLightbox').onClick(async () => {
        const item = await $w('#dynamicDataset').getCurrentItem();
        const id = item._id;
        wixWindowFrontend.openLightbox("Dynamic Lightbox", id);
    })
```

![A screenshot of pasting the second snippet of code in the dynamic item page's code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/baa71c33-2bb5-4b6a-9690-4d612b35bc0b/a3fe6cd8-e912-4430-a8b4-c62fa33dcf07.png)

1. In the sample code you pasted, replace the IDs listed below with those used by your site:  
   * **openLightbox:** Replace with the ID of the button that opens the popup.  
   * **dynamic Dataset:** Replace with the ID of the dynamic item page dataset.  
   * **Dynamic Lightbox:** Replace with the name of the popup.

![A screenshot showing the IDs and lightbox name that needs to be replaced in the code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/fdb65ab7-6ff3-4f63-905e-823b84e1fa32/da8227db-74d9-4688-8e8b-ec526a493722.png)

1. In your editor, go to the popup.
2. Add a dataset and connect it to the same collection as your dynamic item page:  
   1. Click **CMS** ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/f0656688-8ed1-488a-888d-62373b7c3a3c/2021/07/13/be1f7f18-9356-4c33-b010-192982c912e9/59fd7aba-c990-4d61-ab3d-ad7d2e1cce16.png) on the left side of the editor.  
   2. Click **Add Content Elements**.  
   3. Click **Dataset.**  
   4. Click the **Choose a collection** drop-down and select the same collection that connects to your dynamic item page.  
   5. Click **Create**.
3. Click the **Items per load** field in the dataset settings and type the number **1**.
4. Connect the elements in your popup (e.g. text, images, buttons) to the dataset:  
   1. Click the relevant element on the popup.  
   2. Click the **Connect to CMS** icon ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2023/06/16/2d484f5d-e1bf-4d48-9e42-82216e8b88de/08e74518-edad-42f8-b007-c974ba767eb6.png).  
   3. Click the dropdowns under **Connections** and select the relevant collection fields or dataset actions.  
   4. Repeat these steps for each element on your popup that you want to connect.
5. Copy the code snippet below and past it at the top of your popup code:

```javascript
import wixWindowFrontend from 'wix-window-frontend';
import wixData from 'wix-data';
```

![A screenshot of pasting the code snippet to the top of the lightbox code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/7b77ff94-f5af-4681-a759-7bb6a5b003cb/446cb13e-355a-4776-82d5-f9eebbe4f2fc.png)

1. Copy the code snippet below and paste it after: **$w.onReady(function () {**

```javascript
const getData = async () => {
       const id = await wixWindowFrontend.lightbox.getContext();
       $w('#dataset1').setFilter(wixData.filter().eq('_id', id));
}
getData();
```

![A screenshot of adding the code snippet above to the lightbox code.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/d6b40156-9694-4cfe-9209-54815ef9d6dc/2024/02/26/b26421b6-7cae-4816-aca6-6dfef9c672eb/0834cfac-a7a9-491a-ac34-423c61044204.png)

1. In the sample code you pasted, replace **dataset1** with the ID of your popup dataset.
2. Preview your site to test the functionality.
3. When ready, publish your site.
