Bootstrap - 无法在移动设备上单击下拉子菜单项,并且第一次单击不会触发导航折叠 [英] Bootstrap - Can't click dropdown child menu items on mobile and first click not triggering nav-collapse

查看:17
本文介绍了Bootstrap - 无法在移动设备上单击下拉子菜单项,并且第一次单击不会触发导航折叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在移动设备上遇到了下拉菜单项的两个问题.具体:

  1. 我的导航折叠不会在第一次点击 btn-navbar 时显示,而只会在 iPhone 上显示.
  2. 虽然我可以切换下拉菜单,但我无法点击移动设备上的任何下拉菜单项.

我的页面在 W3 验证器上有效,并且我已将 .nav-collapse 和 .collapse 类添加到我的导航栏.另外,在我的笔记本电脑上调整浏览器窗口大小时一切正常.

您可以在此处查看实时网页:http://hartmandashboard.com/

有没有人见过这个问题?有人愿意提供潜在的解决方案吗?我很感激任何帮助.

谢谢

解决方案

是的,我以前看过这个,我在 github 上也看到了这个问题.我不记得我是在哪里找到的,但有人说将这些元素设置为 position: absolute; 是一个问题,将它们重新设置为 static 可以解决问题.>

那么为什么不继续在您的自定义 CSS 上尝试这个:

CSS

.dropdown-backdrop {位置:静态;}

让我知道我们是否在同一页面上并且这解决了您的问题.

I've run into two issues with dropdown menu items on mobile devices. Specifically:

  1. My nav-collapse isn't shown on the first click of btn-navbar, but only on an iPhone.
  2. While I can toggle dropdowns, I can't click on any dropdown-menu items on mobile devices.

My page is valid on W3 Validator and I have added both the .nav-collapse and .collapse classes to my navbar. Plus everything works fine when resizing the browser window on my laptop.

You can see the live web page here: http://hartmandashboard.com/

Has anyone seen this problem before? Anyone care to offer a potential fix? I'd appreciate any help.

Thanks

解决方案

Yes, I've seen this before and I saw the issue is on github as well. I don't remember exactly where I found this, but some guy was saying that it was an issue about setting those elements to position: absolute; and that re setting them to static would fix it.

So why don't you go ahead and try this on your custom CSS:

CSS

.dropdown-backdrop {
  position: static;
}

Let me know if we're on the same page and this solved your issue.

这篇关于Bootstrap - 无法在移动设备上单击下拉子菜单项,并且第一次单击不会触发导航折叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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