【问题标题】:I can't seem to get my website's mobile nav to work我似乎无法让我的网站的移动导航正常工作
【发布时间】:2015-02-26 20:15:02
【问题描述】:

我一直在创建一个网站,我正在使用带有材料设计主题的 Bootstrap 3.2.0。当我进入我的网站并将窗口调整为更小并单击按钮打开导航时,没有任何反应。

这是我的代码:

<html lang="en">     
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>

<link rel="stylesheet" href="css/bootstrap.min.css"></link>

<link rel="stylesheet" href="material/dist/css/ripples.min.css"></link>

<link rel="stylesheet" href="material/dist/css/material-wfont.min.css"></link>

<link rel="stylesheet" href="fezvrasta.github.io/snackbarjs/dist/snackbar.min.css"></link>

<meta content="width=device-width, initial-scale=1" name="viewport"></meta>
<body>
        <div class="navbar navbar-warning">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-warning-collapse" aria-controls="navbar">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="javascript:void(0)">Python for Beginners</a>
            </div>
            <div class="navbar-collapse collapse navbar-warning-collapse">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="javascript:void(0)">Learn</a></li>
                    <li><a href="javascript:void(0)">Contact</a></li>
                </ul>

            </div>
        </div>
    </body>    
</html>

这是材料主题的网站:http://fezvrasta.github.io/bootstrap-material-design/#about

我还没有制作 JSFiddle,因为我不确定如何向其中添加引导程序。

网站在线:pythonforbeginners.site90.com

【问题讨论】:

  • 要将 Bootstrap 添加到小提琴中,请打开左侧的“外部资源”窗格,然后在输入框中输入您喜欢的 CDN 的 URL。示例 CDN: //maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js (js), //maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css ( css)。
  • 这里是your HTML with all the dependencies included。在上面的示例中,除了 jQuery 之外,您没有链接到任何涉及的 javascript 库。
  • 没有显示代码中的脚本标签...这是故意的吗?

标签: javascript html css twitter-bootstrap-3 bootstrap-material-design


【解决方案1】:

包括引导脚本——没有它,这些东西将无法工作。将此添加到您的文档中,在您的 jQuery 脚本标签下方:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

【讨论】:

    猜你喜欢
    • 2013-11-23
    • 2012-11-09
    • 1970-01-01
    • 1970-01-01
    • 2022-11-13
    • 1970-01-01
    • 1970-01-01
    • 2020-05-29
    • 1970-01-01
    相关资源
    最近更新 更多