简体   繁体   English

带有响应式导航菜单的Chrome错误

[英]Chrome bugs with responsive navigation menu

I've been working on a responsive menu which works fine for the most part. 我一直在研究响应式菜单,该菜单在大多数情况下都可以正常工作。 I tried it in my phone and my desktop with both chrome and mozilla. 我在手机和台式机上同时使用chrome和mozilla进行了尝试。 But it gets buggy in Chrome. 但是在Chrome浏览器中却出现了问题。

only the first menu item can be clicked when you resize chrome and get the smaller menu for smaller viewports. 调整chrome大小并为较小的视口获得较小的菜单时,只能单击第一个菜单项。

This bug is not present in mozilla for desktop nor mozilla for android. 适用于台式机的mozilla或适用于Android的mozilla均不存在此错误。 However it is present in both Chrome for desktops and mobiles. 但是,台式机和移动版Chrome都存在该功能。

if you run this jsfiddle in mozilla you will see it working well http://jsfiddle.net/LNh3e/ I can't say the same for chrome because it's not working as expected. 如果您在mozilla中运行此jsfiddle,您会发现它运行良好http://jsfiddle.net/LNh3e/对于chrome,我无法说同样的话,因为它无法正常工作。

Usually this type of errors are shown because of a unclosed tag but I can't find one: 通常由于未封闭的标签而显示这种类型的错误,但我找不到一个:

                       <nav>
                            <ul>
                                <li><a href="index.php">Home</a></li>
                                <li><a href="about.php">About</a></li>
                                <li><a href="portfolio.php">Portfolio</a></li>
                                <li><a href="contact.php">Contact</a></li>
                                <li><a href="services.php">Services</a></li>
                            </ul>

                        </nav>

In order to get the smaller viewport, resize the window yo 770px or lower 为了获得较小的视口,请调整窗口尺寸为770px或更小

I dont know why this bug is showing up. 我不知道为什么这个错误会出现。 Your help is greatly appreciated. 非常感谢您的帮助。

It appears to be a stacking problem. 它似乎是一个堆叠问题。 Defining a z-index for #main_menu fixes it. #main_menu定义一个z-index可以修复它。

#main_menu {
    ....
    position: relative;
    z-index: 1;
}

Fiddle: http://jsfiddle.net/marionebl/LNh3e/4/ 小提琴: http : //jsfiddle.net/marionebl/LNh3e/4/

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

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