简体   繁体   English

Bootstrap Mobile Dropdown菜单链接无法点击

[英]Bootstrap Mobile Dropdown menu links not clickable

I am using the latest version of Twitter Bootstrap ( 2.3.2 ) as the framework for my site. 我使用最新版本的Twitter Bootstrap(2.3.2)作为我网站的框架。

The only issue I have run into with Bootstraps navmenu is that when viewing the site on my phone, the dropdown links are not clickable. 我在Bootstraps navmenu中遇到的唯一问题是,当我在手机上查看网站时,下拉链接无法点击。 When you try to click the link the menu closes. 当您尝试单击链接时,菜单将关闭。 Links outside of the dropdown work just fine though. 下拉列表之外的链接工作正常。 I checked in my bootstrap-dropdown.js and looked for a recommended line of code I found on a GitHub discussion that is supposed to fix the issue but it was already there. 我检查了我的bootstrap-dropdown.js,并查找了我在GitHub讨论中找到的推荐代码行,该代码应该可以修复问题,但它已经存在了。 What's the fix for this? 有什么办法解决这个问题? I appreciate any help with this matter. 我对此事表示感谢。

  /* APPLY TO STANDARD DROPDOWN ELEMENTS
   * =================================== */

$(document)
.on('click.dropdown.data-api', clearMenus)
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api'  , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)


}(window.jQuery);

I experienced the same issue. 我遇到了同样的问题。 The submenus were not clickable on my mobile. 子菜单无法在我的手机上点击。 I added the following javascript and it seems to work. 我添加了以下JavaScript,它似乎工作。

jQuery(document).ready(function($) {
    $("li.dropdown a").click(function(e){
        $(this).next('ul.dropdown-menu').css("display", "block");
        e.stopPropagation();
        });
});

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

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