Jquery - Hide div if it is empty

situation:

The pop up should only appear if the customer has created an entry in a specific CMS Collection.

If the collection is empty, the popup should not appear.

Does anyone have the appropriate code/script for this?

Search for a long time now, but find nothing.

The fact that a div is not shown if the collection is empty, I get it. But I would need a close button in the popup, so the div with the close button would always be shown, even if the collection is empty.

Here is the script for:
https://stackoverflow.com/questions/44068834/jquery-hide-div-if-it-is-empty

Thanks a lot for your help.
Below is the example i want to run it.


Here is my site Read-Only: https://preview.webflow.com/preview/popup-test-b3bb3b?utm_medium=preview_link&utm_source=designer&utm_content=popup-test-b3bb3b&preview=7fc2950713fd61edccb60f4c14376766&mode=preview
(how to share your site Read-Only link)

solved it.

quick easy, without script.
Just to set the empty colletion item to non display. thats it.