I have a panel with a Close Me button but would like it to close when the user clicks outside the panel; I have searched (Google and ChatGPT) but failed to make it work - will appreciate some code to do this…
thanks
Hi,
Check this:
This parameter can be used to close panel when clicked outside.
closeByBackdropClick not working (and explicitly set to true in panel opening function…)
Can you post your code please.
Heere is my code:
function openLeft() {
// var panel = app.panel.open(‘.panel-left’);
var panel = app.panel.create({
el: ‘.panel-left’,
resizable: true,
swipe: true,
closeByBackdropClick: true,
visibleBreakpoint: 200, //enables panel view on narrow device
// collapsedBreakpoint: 768
})
}
thanks
Do the other attributes work correctly, as in is the panel still resizable?
Yes, panel is resizable
thanks
I think there must be something else wrong with your code here. Could the surrounding page be capturing the clicks somehow, and not passing it onto F7?
You shouldn’t need to specify closeByBackdropClick
because it is true
by default. It would give you the expected behaviour without declaring that parameter. That’s what makes me feel that something else is influencing your page.
I should have realised! The surrounding page is a Leafletjs map which, of course, listens for clicks on the various markers.
Thanks for helping me discover the issue…