从Modal打开Modal [英] Open Modal from Modal

查看:97
本文介绍了从Modal打开Modal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用twitter-bootstrap并使用Modal JS插件。我有一个打开的模态,想要从打开的原始模态打开另一个模态。

I'm using twitter-bootstrap and am using the Modal JS plugin. I have a modal which is open and want to open another modal from the original modal that is open.

原因是,用户可以从下拉列表中选择一个选项。如果他们想要选择的项目不在列表中,他们可以单击按钮并添加新按钮。

The reasoning, is the user can select an option from the dropdown list. If the item they want to select isn't in the list, they can click a button and add a new one.

我试图隐藏原始模态,然后显示新模态,但我只是在显示背景时陷入困境。当我尝试一起打开它们时,背景变暗(因为我现在已经在已经存在的背景上放置了另一个背景,我仍然可以看到原始模态。

I've tried to hide the original modal, then show the new one, but I get stuck with just showing the backdrop. When I try and open them together, the backdrop gets dark (since I've now placed another backdrop on top of the one already existing and I can still see the original modal.

理想情况下,我可以打开一个模态,然后打开另一个就像今天用一个模态一样简单。

Ideally I could open a modal, then open another just as easy as doing it today with one modal.

推荐答案

我的问题是第二个模态是在第一个模式的内部,所以当我隐藏第一个模式时,我无法显示第二个模式(这就是为什么我只剩下背景)。我最后只是调用模态。('隐藏')在第一个模态,然后在第二个模态('show')。

My problem was the 2nd modal was inside the file of the first, so when I hid the first, I couldn't show the 2nd one (which is why I was left with just the backdrop). I ended up just calling modal.('hide') on the first modal, then modal('show') on the 2nd.

这篇关于从Modal打开Modal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆