Bootstrap 3.0菜单无法在移动设备上运行

时间:2014-01-10 20:50:32

标签: twitter-bootstrap menu twitter-bootstrap-3 collapse

我在bootstrap 3.0中看到一个问题,当菜单折叠时导航菜单不起作用。要查看示例,请转到此处:http://apexenergetics.azurewebsites.net/

我开始认为我可能缺少一个Javascript文件。我在我的iPhone5和我的iPad上测试了网站。在浏览器中查看时工作正常。

更新:它似乎在Windows手机上运行良好。此外,只有带下拉菜单的项目不起作用。链接/按钮没有下拉工作。

<header>
        <div class="row">
            <div class="col-xs-12 col-md-6">
                <img src="@Href("~/img/logo.png")" alt="Apex Energetics">
            </div>
            <div class="col-xs-12 col-md-6">
              @*<form class="form-search">
          <input type="text" class="input-medium search-query" placeholder="Search Apex Energetics">
          <button type="submit" class="search-btn" >Search</button>
            </form>*@
            </div>
        </div>

      <!-- Static navbar -->
      <div class="navbar">
        <div class="container">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="@Href("~/index")">Home</a>
          </div>
          <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
              <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apex Complexes <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/K-Line_Formulas")">K-Line Formulas</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/K-plex")">&nbsp;&nbsp;&#187;K-Line Nutritionals</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/K-Line_Creams")">&nbsp;&nbsp;&#187;K-Line Creams</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/K-Line_Homeopathics")">&nbsp;&nbsp;&#187;K-Line Homeopathics</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/Z-plex")">TerrainZyme&reg; Formulas</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/L-plex")">Cellegion Formula&reg;</a>
                  </li>
                </ul>
              </li>
              <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Homeopathics <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/antitox")">Antitox&reg;</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/A-plex")">&nbsp;&nbsp;-B-Plex</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/B-plex")">&nbsp;&nbsp;-B-Plex</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/C-plex")">&nbsp;&nbsp;-C-Plex</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/D-plex")">&nbsp;&nbsp;-D-Plex</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/E-plex")">&nbsp;&nbsp;-E-Plex</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/N-plex")">&nbsp;&nbsp;-N-Plex</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/W-plex")">&nbsp;&nbsp;-W-Plex</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/S-plex")">Allertox</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/R-plex")">RegenRx</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/G-plex")">Metaboplex</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/M-plex")">Endotox</a>
                  </li>
                  <li class="dropdown-toggle">
                    <a href="@Href("~/products/flowers")">Flower Combinations</a>
                  </li>
                </ul>
              </li>
              <li><a href="@Href("~/products/purvela")">Purvela&trade;</a></li>
              <li><a href="@Href("~/pages/contact")">Contact Us</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
</header>

1 个答案:

答案 0 :(得分:0)

适合我。有一个问题,Bootstrap 3的下拉有时在触摸时不起作用。如果这是您的问题,您可以将移动折叠下拉按钮定位为仅此类...

if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {}

...并为移动设备上的下拉菜单添加单独的功能。