Close multiple Popups with 1 click

Hey!
I have multiple dynamic popups open. When i click on a link a page is loading but in the back. I insert app.popup.close() on the pageInit but it closes only one popup. Any suggestion how to close all open popups at one time?

Have you try with a css class.
Change the ‘el’ for the css class, if all the Popup open has the same class, they gonna be close.

app.popup.close(el, animate)- closes Popup

* el - HTMLElement or string (with CSS Selector). Popup element to close.
* animate - boolean. Close Popup with animation.

Method returns Popup's instance

I did’t try, but i think it can work.

That’s what i tried first but it doesn’t work. It will close only the first popup:
app.popup.close('.popup')

WHen popup is open adds “modal-in” class to div.
You can make an .each function to detect which div has class “modal-in”.

Didn’t test, but something like this.

$('.popup').each(function(i, el){
      if ($(this).hasClass('modal-in')) {
       app.popup.close();
      } else{
     }
    }
})