[SOLVED] Closing panel on popup opening

When a popup appears I want to ensure any open panel is closed - adding class = ‘panel-close’ to any of the popup elements does now =work (popup opens but panel stays in view).
is there another way to close any open panel when a popup opens?
thanks

hi,
maybe find every panel in the dom and close them, before your popup appear?

eg:

...your magic code
  function closeLeftPanel() {
    // TODO; Run for if you have more than one panel on each side. 
    // I dont know your case. since you share little code
    // let lp = document.getElementsByClassName('panel-left')
    let _p = app.panel.get('panel-left')
    _p.close(side, animate)- close panel
  }
}

Didnt test the code, just for example

Panel doc

https://framework7.io/docs/panel.html#panel-app-methods

SOLVED
This does it:

$$(’.popup’).on(‘popup:open’, function (e, popup) {
app.panel.close();
});

works whichever popup is open.

2 Likes