开发者

Open a modal from a modal with SimpleModal by Eric Martin

I'm using SimpleModal by Eric Martin to cre开发者_如何学运维ate modals for a project, and I have a situation where I need to open a second modal on top of a modal that I already have open. Does anybody know how I can achieve this?


Eric Martin, could answer better (I know he uses SO as his tech support venue), but I'm fairly certain that SimpleModal is a single instance only plugin. I say this because a single overlay (div) is created to accommodate multiple dialogues on a page, and you can not display more than one dialogue at a time.

Proof: http://jsfiddle.net/QtbQQ/2/

To accommodate dialogues within dialogues, I'd imagine that you'd need to heavily modify this plugin.

For instance:

  • $.modal.close(); Need update to target specific modal dialogues.
  • Create a dialogue hierarchy model (parent-child relationships).
  • You'll need to dynamically adjust the z-index of the overlay to cover all parent dialogues as their children are created.

In short, this all seems very possible, but it is certainly not supported by this plugin as is.

Perhaps you could put a prototype together and see if Eric would add it in!


There is a "hack" around it:

your-container.modal( {
    onOpen: function () {
         var oldContent = escape(your-container).html();
    },
    onClose: function () {
         your-container.html(unescape(oldContent)).css('height','auto').css('width','auto');
    }
});

Also, Eric mentions the "persist" which I haven't being able to understand but, for what I could gather, it has to do with keeping DOM related stuff persistent across modals. In this case, modal( { persist:true } ).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜