Bootstrap 3.3 - Navbar无法在移动设备上运行

时间:2015-02-27 10:14:15

标签: javascript jquery css twitter-bootstrap jsf

我尝试在jquery-bootstrap脚本之前加载jquery-source脚本,方法是更改​​内部的顺序" head"元素,但它没有工作,我也确保链接bootstrap CSS文件。

我看了一下bootstrap default navbar example,看来一切正常,但仍然没有用?

最后,我使用的是JSF-2.2框架,我不知道它是否与此问题有关?这是完整的代码

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://xmlns.jcp.org/jsf/html"
  xmlns:jsf="http://xmlns.jcp.org/jsf"
  xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
  ng-app="indexApp">
<head jsf:id="head">
    <meta charset="utf-8"></meta>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
    <meta name="viewport" content="width=device-width, initial-scale=1"></meta>
    <meta name="description" content=""></meta>
    <meta name="author" content=""></meta>

    <title>website</title>
    <!-- AngularJs-Module  !-->
    <script jsf:target="body" jsf:name="index/js/indexAppModule.js"></script>
    <!--jQuery-->
    <script jsf:target="body" jsf:name="lib/jquery/jquery-2.1.3.min.js"></script>
    <!--Bootstrap Core JavaScript-->
    <script jsf:target="body" jsf:name="lib/bootstrap-3.3.2-dist/js/bootstrap.min.js"></script> 
    <!-- Parallax !-->
    <script jsf:target="body" jsf:name="lib/stellar/jquery.stellar.js"></script>
    <!-- Parallax !-->
    <script jsf:target="body" jsf:name="index/js/parallax.js"></script>
    <!-- Bootstrap Core CSS -->
    <link jsf:library="lib/bootstrap-3.3.2-dist/css" jsf:name="bootstrap.min.css"
          href="lib/bootstrap-3.3.2-dist/css/bootstrap.min.css" type="text/css" rel="stylesheet"> 
    </link>
    <!-- Custom CSS -->
    <link jsf:library="index/css" jsf:name="landing-page.css"
          href="index/css/landing-page.css" type="text/css" rel="stylesheet">
    </link>
    <!-- Custom Fonts -->
    <link jsf:library="index/css/font-awesome/css" jsf:name="font-awesome.min.css"
          href="index/css/font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet">
    </link>
    <!-- form Style -->
    <link jsf:library="index/form/css" jsf:name="formstyle.css"
          href="index/form/css/formstyle.css" type="text/css" rel="stylesheet">
    </link>
    <!-- fonts !-->
    <link href="http://fonts.googleapis.com/css?    family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css"></link>
    <!--Index Style -->
    <link jsf:library="index/css" jsf:name="index.css"
          href="index/css/index.css" type="text/css" rel="stylesheet">
    </link>
</head>

<body jsf:id="body">

    <!-- Navigation -->
    <nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
        <div class="container topnav" id="navfluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigationbar">
                    <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 topnav" href="#">Start Bootstrap</a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="navigationbar">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="#home">Home</a>
                    </li>
                    <li>
                        <a href="#features">Features</a>
                    </li>
                    <li>
                        <a href="#technologies">Technologies</a>
                    </li>
                    <li>
                        <a href="#contact">Contact</a>
                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->
    </nav>

    <div class="section" id="home" data-stellar-background-ratio="0.5">
        <div>
            <div class="container">
                <div class="row">
                    <div class="col-md-12">
                        <div class="intro">
                            <h1>Website</h1>
                            <h3>website</h3>
                            <hr class="intro-divider"></hr>
                            <form>
                                <input name="name" placeholder="Username" class="name" required="true"></input>
                                <input type="password" name="name" placeholder="Password" class="name" required="true"></input>
                                <input name="submit" class="btn-login" type="submit" value="LogIn"></input>
                                <input name="submit" class="btn-login" type="submit" value="SignUp"></input>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="section" id="features" data-stellar-background-ratio="0.5">

    </div>
    <div class="section" id="technologies" data-stellar-background-                  ratio="0.5">

    </div>
    <div class="section" id="contact" data-stellar-background-ratio="0.5">

    </div>
</body>

1 个答案:

答案 0 :(得分:0)

使用“src”属性代替“library”和“name”jsf的属性解决了这个问题 我发现原因是因为我在脚本标签内使用(jsf:libray =“”和jsf:name =“”)。!
生成的HTML文件具有无效的javascript文件URL,这意味着没有脚本正在运行。