我的小屏幕引导导航下拉列表无效

时间:2017-07-26 22:47:31

标签: javascript html5

我的小屏幕(手机和平板电脑)的导航下拉按钮无效。我已经包含了JS文件,但它仍然无法正常工作。任何人都可以帮助确定为什么这不想与我的js文件连接。

  

HTML

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.mini.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<!-- Header -->
    <header>
        <nav class="navbar navbar-default navbar-fixed">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="index.html">AffAttraction</a>
                </div>
                <div class="collapse navbar-collapse" id="myNavbar">
                <ul class="nav navbar-nav">
                    <li><a href="index.html">Home</a></li>
                    <li><a href="advertisers.html">Advertisers</a></li>
                    <li><a href="publishers.html">Publishers</a></li>
                    <li><a href="blog.html">Blog</a></li>
                    <li><a href="about.html">About Us</a></li>
                    <li><a href="contact.html">Contact Us</a></li>
                </ul>
                <form class="navbar-form navbar-right">
                <input type="email" name="email" class="form-control" placeholder="Email" required="">
                <input type="password" name="password" class="form-control" placeholder="Password" required="">
                <button type="submit" class="btn btn-green">Login <span class="glyphicon glyphicon-log-in"></span></button>
                </form>
                </div>
            </div>
        </nav>
    </header>
<!-- Header -- >
<!-- Showcase -->
    <div id="showcase">
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                <h1><span class="highlight">Performance</span> Based Marketing</h1>
                <p>Do you have traffic? Let us help you monetize and profit from your websites, apps, games, blogs, and more!</p>
                </div>
            </div>
        </div>
    </div>
<!-- Showcase -->
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap.mini.js"></script>
</body>
</html>

如果您认为这可能是一个问题,我已将它包含在我的CSS链接的顶部。我也尝试将它放在body标签和html标签下。我迷失了该怎么做。那些文件确实存在!

2 个答案:

答案 0 :(得分:0)

我尝试运行您的代码,用CDN版本替换本地引导程序样式表。当我加载它时,我崩溃了因为jQuery丢失了。在头部添加jQuery后,它起作用了:

<script src="http://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>

答案 1 :(得分:0)

如果要连接CSS上的Bootstrap JSHTML文件,可以使用Bootstrap CDN轻松完成。

将此添加到您的<head>作为Bootstrap样式表 https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css

这是你的<body>作为Bootstrap JavaScript链接 https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js

同时添加JQuery for Bootstrap以正常工作 https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js