OGeek|极客世界-中国程序员成长平台

标题: android - Bootstrap 下拉菜单在 Android 上不起作用 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 20:41
标题: android - Bootstrap 下拉菜单在 Android 上不起作用

问题

如果你去 https://oorkle.com/browse从桌面浏览器查看左侧,您会看到一个使用 Bootstrap 下拉菜单的过滤器/侧边栏,您会看到它们可以正常工作(它们会下拉):

enter image description here

如果你足够缩小 View ,一些 jQuery 会将这些下拉菜单移动到二级顶部导航栏中,但它们仍然可以工作(它们会下拉):

enter image description here


现在,如果您在从 Android 或 iOS(iPhone 或 iPad)加载页面时尝试这些相同的操作,您会发现下拉菜单不再起作用:

enter image description here

enter image description here


HTML

如果你 diff the HTML of the desktop version and the HTML of the Android/iOS version ,您只会看到细微的 CSS 差异:

enter image description here enter image description here enter image description here


如果你 diff the live HTML (with modifications from JavaScript) ,与上面的差异唯一真正的区别是每个选择器都添加了一个 mobile 类:

enter image description here


我尝试过的


我猜发生了什么

在我看来,Bootstrap 正在以某种方式使用用户代理字符串,这导致下拉菜单不起作用。


我在网上找到的相关问题

更新



Best Answer-推荐答案


问题似乎是使用 FormStone Selecter plugin 进行选择的结果(v2.2.3),它大概使用 jQuery 来处理点击,it seems Android now treats as a security threat and does not allow .

为了解决这个问题,我让我的 Web.py(Python Web 框架)模板文件查看用户代理字符串,如果出现“android”,它会将 selects 的类设置为“form-control”(一个 Bootstrap class),从而让 Bootstrap 为选择设置样式,如果用户代理字符串中的“android”not,它将照常使用 FormStone Selecter 插件。

所以,澄清一下:尽管我认为选择使用 Bootstrap 并且 Bootstrap 不起作用,但事实证明选择没有使用 Bootstrap,并且 Bootstrap v3.0.3 选择了 < em>确实在 Android 上工作。

关于android - Bootstrap 下拉菜单在 Android 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52799817/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4