简体   繁体   English

涉及绝对值和Z索引时的怪异iOS行为

[英]Weird ios behaviour when absolute and z-index are involved

I have a menu that should be in the home-page which is like this: 我的菜单应该在首页中,如下所示:

<nav class="main-menu"></nav>

And the main-menu css is a simple: 而且主菜单css很简单:

.main-menu {
  height: 30%;
  width: 100%;
  position: absolute;
  bottom: 0;
  z-index: 11;
}

When in ios (after cordova compiling), i dont see the nav at all. 在ios中(在cordova编译之后),我根本看不到导航。 Inside of the nav i have 3 very big buttons, and when i press on the ios screen (where the nav bar is supposed to be but not shown to me), it redirects me to where i want as if the nav is there but i just dont see it, What can be the cause of this weird behaviour? 在导航内,我有3个非常大的按钮,当我在ios屏幕上按(应该在导航栏上但未显示给我)时,它会将我重定向到我想要的位置,就好像导航在那儿一样,但是我只是看不到,这种奇怪行为的原因可能是什么?

Have you set your html / body CSS like this? 你有没有这样设置html / body CSS?

html, body {
    height: 100%;
}

If not, you won't be able to use percentage for height values (relative to the screen size, this is). 否则,您将无法使用百分比作为高度值(相对于屏幕尺寸,是这样)。 You can set the height to some pixel value, which will also work. 您可以将高度设置为某个像素值,这也将起作用。

Although this may be a z-index issue. 尽管这可能是z-index问题。 Try setting z-index to 9999 and see if it is visible. 尝试将z-index设置为9999 ,看看是否可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM