简体   繁体   English

Bootstrap Mobile菜单问题

[英]Bootstrap Mobile Menu Issue

I have a website at: https://www.romaheritage.co.uk 我有一个网站: https : //www.romaheritage.co.uk

The issue is the Bootstrap menu at the top of the page; 问题是页面顶部的Bootstrap菜单; it works fine on desktop PCs/Laptops, but when viewed on mobile devices (phones/tablets) the two drop-down menu options "Records" & "Misc" won't expand out (at least on Android they won't, not sure about IOS because I can't test it). 它在台式机/笔记本电脑上工作正常,但是在移动设备(电话/平板电脑)上查看时,两个下拉菜单选项“记录”和“其他”不会扩展(至少在Android上不会扩展)请确保有关IOS,因为我无法对其进行测试)。 I think I'm overlooking something which may be obvious to others. 我认为我正在忽略一些可能对其他人显而易见的东西。

Can anyone view the source for the page and point me in the direction of what I've done wrong? 任何人都可以查看该页面的源代码,并向我指出我做错了什么吗?

I made it work by replacing the a.dropdown-toggle by a div.dropdown-toggle. 我通过将div.dropdown-toggle替换a.dropdown-toggle使其工作。

The css is not good then but I believe you can make this right. 当时的CSS不好,但我相信您可以做到这一点。

Here's the code 这是代码

<div class="collapse navbar-collapse" id="tb-nav-collapse">
      <ul class="nav navbar-nav navbar-right">
        <li><a class="page-scroll" href="http://www.romaheritage.co.uk/#about">About</a></li>
        <li class="dropdown">

             <!-- Change a to div -->
            <div class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Records <span class="caret"></span></div>

            <ul class="dropdown-menu">
              <li><a href="http://www.romaheritage.co.uk/parish-records">BMD</a></li>
              <li><a href="http://www.romaheritage.co.uk/census-records">Census</a></li>
            </ul>
          </li>
        <li><a class="page-scroll" href="http://www.romaheritage.co.uk/newspaper-articles">Newspapers</a></li>
        <li><a class="page-scroll" href="http://www.romaheritage.co.uk/#blog">Blog</a></li>
        <li class="dropdown">

          <!-- Change a to div -->
          <div class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Misc. <span class="caret"></span></div>

          <ul class="dropdown-menu">
            <li><a href="http://www.romaheritage.co.uk/queen-victorias-journals">Queen Victorias Journals</a></li>
          </ul>
        </li>
        <li><a class="page-scroll" href="http://www.romaheritage.co.uk/#contact">Contact</a></li>
      </ul>
    </div>

try this one... 试试这个...

$("li.dropdown").click(function(e){
  $(this).toggleClass("open");
});

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

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