New: allow multiple modals (fix #101)#127
Conversation
|
I was worried about this change as I have always used the modals with the thought of just one being visible at the time, but then I read about |
|
Cool, looks good! I can't say I've ever needed multiple modals myself, but the request for multiple modals has come up before so it seems legit 🍔 A couple things to sort out before I merge:
|
|
+1 Was about to sit down and extend the plugin with this same functionality. Glad I checked out the issues first. ;) Can I suggest going with |
|
I'm not crazy about For example, instead of |
|
Agreed. Definitely should be added as an opt- The example use case I'm running into right now is, I have a modal with a form which has rules & privacy links. The rules & privacy content are both setup as individual modals which are linked to from other parts of the application apart from the form modal links. I don't want to close out the form to show the rules, but rather just have the additional modals displayed on top of the form modal. |
|
@kylefox I had first named it Now that you're raising the point, maybe we could use a verb instead of an adjective: |
|
@xfra35 Good point. Appreciate the thought everyone is putting into this 😎 |
|
Or maybe |
|
What is the status of this PR? I see that the author must resolve some conflicts. |
|
Sorry guys, was so busy at that time that I've completely missed it. Will try to merge it in a week or two. |
|
Cool, thanks for bumping this @hultberg — I think it would be a valuable addition :) |
|
Hey guys, I finally had time to dig into this PR. I've refactored it in #146. |
Here's a code change proposal to allow multiple modals to be opened at the same time (#101).
In short:
currentvariable is replaced by amodalsarrayuniqueoption is introduced, which determines if the new modal should be unique or not (i.e if existing modals should be closed or not). This option defaults totrue, in order to keep backwards compatibilitycurrentclass while the other ones get thebehindclass, thus allowing any styling for the modals in backgroundA test demo is visible here.
NB: if you're interested in this change, as well as the one suggested in #110, you might be interested by the merging result of those two, which I prepared as well (I needed it for a project).