Bootstrap 3折叠菜单无法在移动设备屏幕上运行

时间:2015-06-16 03:30:53

标签: jquery css twitter-bootstrap twitter-bootstrap-3

似乎很多人都遇到了这个问题(https://github.com/twbs/bootstrap/issues/7968),但对某些人有用的解决方案对我不起作用。

如果您尝试在http://axxon.co打开我的网站并调整窗口大小,直到出现汉堡菜单,您会注意到如果您点击带有子菜单的项目(福利或行业),则不会发生任何事情。

有谁知道我能做些什么来解决这个问题?

3 个答案:

答案 0 :(得分:4)

查看 Fiddle here 或下面的代码段。

它只有标准的Bootstrap css / js。你的菜单,工作正常,没有问题,如在你的网站。看一下,点击时你是否有一些js关闭链接。

我认为您会发现问题出在此文件axxon/js/creative.js中。单击时关闭菜单的问题。



<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Starter Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">


</head>

<body>
    
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand page-scroll logo logo_black" href="http://axxon.co/">
                    Axxon Tracking
                </a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-right">
                    <li class="active">
                        <a href="./">Home</a>
                    </li> 
                    <li>
                        <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" href="./benefits.php">Benefits <span class="caret"></span></a>
                          <ul class="dropdown-menu" role="menu">
                            <li><a href="./reduce-fuel-costs.php">Reduce Fuel costs</a></li>
                            <li><a href="./eliminate-theft-and-waste.php">Eliminate Theft and Waste</a></li>
                            <li><a href="./reduce-maintenance-costs.php">Reduce Maintenance Costs</a></li>
                            <li><a href="./reduce-labor-costs.php">Reduce Labor Costs</a></li>
                            <li><a href="./improve-safety.php">Improve Safety</a></li>
                          </ul>

                    </li>
                    <li>
                        <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" href="./industries.php">Industries <span class="caret"></span></a>
                          <ul class="dropdown-menu" role="menu">
                            <li><a href="./construction-and-heavy-equipment.php">Construction &amp; Heavy Equipment</a></li>
                            <li><a href="./distribution.php">Distribution</a></li> 
                            <li><a href="./transportation.php">Transportation</a></li> 
                            <li><a href="./insurance.php">Insurance</a></li> 
                          </ul>
                    </li> 
                    <li>
                        <a href="./contact.php">Contact</a>
                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
    
    
    
   


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    
</body>
</html>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

看起来你的小姐错过了课程&#39;下拉&#39;

<li class="dropdown">
 <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
 <span>Test</span>
 <b class="caret"></b>
 </a>

 <ul class="dropdown-menu">...

答案 2 :(得分:0)

我在Bootstrap 3.3.6中遇到此问题,但这是用户错误。一个人必须在加载bootstrap之前加载jQuery ,如下所示:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
        integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
        crossorigin="anonymous"></script>