Toggle popup when clicked again
Closed this issue · 3 comments
xsparshx commented
Imagine i am loading content using ajax and user click the button again and again , I dont want him to open multiple popup of same content , is it possible to implement that if user click the button again that close the popup window and reopen if clicked again.
Flyer53 commented
@xsparshx
Sounds like a reasonable idea. Thanks for the input :)
I think about this for version 2.3.0 I'm working on. Might it even be better to simply prevent the opening of an identical panel again and again as long as one is open?
Flyer53 commented
@xsparshx
Meanwhile you could do something like this:
$("#trigger").click(function () {
if ( $("#panel_1").length < 1 ) {
$.jsPanel({
id: "panel_1",
// rest of your panel config
});
}
});
This checks whether a panel with a certain ID already exists in your document and creates the panel only if not.
xsparshx commented
Thank you, This will also solve the problem :)