Closing popup based on viewport size changes

I’m trying to come up with a way for a popup to close based on the viewport size changing in browser and am not having any luck. Say your view port is 1920x800 and you drag your window and make it 1000x500, I want that change to be the trigger to close the open popup. I already have a method built to determine the size of the popup based on the view port but that only happens on open, if the popup is open and you change the window size it stays open and the only way to close it is refreshing the page. Any help would be great.

That only works if you click in the window

1 Like

:man_shrugging:

I’m pretty sure you can only detect the window size change with a media query. I’m not sure if you can do that from the advanced stylesheet, but I’d bet it would have to be javascript injection.

You are better off with a different design, maybe add a timeout on the popup to close itself after x amount of inactivity.