使用 Eric Martin 的 SimpleModal 从模态中打开模态

发布于 2024-12-06 04:42:26 字数 93 浏览 0 评论 0原文

我正在使用 Eric Martin 的 SimpleModal 为项目创建模态,我遇到了一种情况,我需要在已经打开的模态之上打开第二个模态。有谁知道我怎样才能实现这一目标?

I'm using SimpleModal by Eric Martin to create 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

入怼 2024-12-13 04:42:26

Eric Martin,可以更好地回答(我知道他使用 SO 作为他的技术支持场所),但我相当确定 SimpleModal 是一个仅单实例的插件。我这样说是因为创建一个覆盖层 (div) 是为了在页面上容纳多个对话,并且一次不能显示多个对话。

证明: http://jsfiddle.net/QtbQQ/2/

为了适应对话中的对话,我'我想您需要大量修改这个插件。

例如:

  • $.modal.close();需要更新以针对特定的模式对话。
  • 创建对话层次模型(父子关系)。
  • 您需要动态调整覆盖层的 z 索引,以在创建子级对话时覆盖所有父级对话。

简而言之,这一切看起来很有可能,但这个插件肯定不支持它。

也许你可以制作一个原型,看看埃里克是否会添加它!

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!

情话难免假 2024-12-13 04:42:26

围绕它有一个“黑客”:

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

此外,Eric 提到了我无法理解的“持久”,但据我所知,它与保持 DOM 相关内容在模态中持久存在有关。在本例中,modal( { persist:true } )

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 } ).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文