Ordering multiple IonicModals on top of each other(在彼此之上订购多个 IonicModal)
问题描述
这里解释了 $ionicModal 服务的用法:http://ionicframework.com/docs/api/service/$ionicModal/
The usage of the $ionicModal service is explained here: http://ionicframework.com/docs/api/service/$ionicModal/
我遇到的情况是我打开了两个以上的模式.
I have a situation where it happens that I open more than two modals.
例如:
- 我先打开一个
loginModal
- 在那里,用户点击一个按钮openSignUp()"打开
SignUpModal
但是,有时注册模式会在登录模式下方打开.所以我必须先关闭登录才能看到它.
However, somethimes it happens that the signup modal is opened below the login modal. So I have to close login before I can see it.
有没有办法- 将新模态推到顶部- 或订购模式?
Is there a way to either - push the new modal to the top - or to order the modals?
推荐答案
当模态框打开时,它们会附加到 DOM 中.因此,请记住您打开 first
的哪个模态,它将被 首先附加到 DOM
.
When modals are opened they are appended to DOM. So remember which ever modal you open first
, that will be appended to DOM first
.
此外,所有模式都有相同的 css z-index:10
.
Also, all modals have same css z-index:10
.
要了解为什么会发生这种重叠.
To understand this why this overlap happens.
Modal1
已打开 -> 附加到 DOMTAG.
Modal2
已打开 -> 在 Modal1 之后附加到 DOMTAG
<div>
标签.Modal3
已打开 -> 在 Modal2 之后附加到 DOMTAG
<div>
标签.
Modal1
is opened -> Gets appended to DOM<body>
TAG.Modal2
is opened -> Gets appended to DOM<body>
TAG after Modal1's<div>
Tag.Modal3
is opened -> Gets appended to DOM<body>
TAG after Modal2's<div>
Tag.
Bug 条件:如果您在 Modal3
上有一个按钮可以打开 Modal2 或 Modal1
Bug condition: If you have a button on Modal3
to open Modal2 or Modal1
Modal1
或 Modal2
将在 Modal3 后面打开.
The Modal1
or Modal2
will open behind the Modal3.
解决方法:您需要操作每个模态的 z-index
以便以任何顺序打开它们,您单击的最后一个模态应该/将在以前打开打开模态.
WORKAROUND: You need to manipulate the z-index
of each modal so that in whatever order they are opened,the last modal you click should/will open over previously opened modal.
我无法为您提供快速解决方案,因为它不是快速解决方案;但是我确实通过阅读源代码并对其进行编辑来解决它.
I cant provided you with a quick solution, because its not a quick fix;however I did solve it by reading the source Code and editing it.
这是我解决问题的方法:Pull Request 到 Ionic repo.您可以轻松阅读那里所做的更改以进行修复.它基本上都是对 z-index
Here is how I fixed my problem: A Pull Request to Ionic repo.
You can easily read the changes done there in order to have a fix. Its all basically manipulation of z-index
这篇关于在彼此之上订购多个 IonicModal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在彼此之上订购多个 IonicModal
基础教程推荐
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01