[Visual Studio Community 2015]我已经链接了Bootstrap字体,CSS和JavaScript(以及一些其他自定义的样式和测试功能)。我在另一个HTML文件中尝试了这个通用代码块,它可以工作(通过Bootstrap)。但出于某种原因,当"箭头"单击我的其他HTML文件,它只会将我移到页面上。
轮播代码 '
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div>
<!-- Controls -->
<a class="left carousel-control" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>'
完整的HTML
.navbar {
margin-bottom: 0;
background-color: steelblue;
z-index: 9999;
border: 0;
font-size: 12px !important;
line-height: 1.42857143 !important;
letter-spacing: 4px;
border-radius: 0;
font-family: Calibri, sans-serif;
}
.navbar li a, .navbar .navbar-brand {
color: #fff !important;
}
.navbar-nav li a:hover, .navbar-nav li.active a {
color: steelblue !important;
background-color: #fff !important;
}
.navbar-default .navbar-toggle {
border-color: transparent;
color: #fff !important;
}
footer .glyphicon {
font-size: 20px;
margin-bottom: 20px;
color: steelblue;
}
&#13;
<!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="A website about the ___ App Studio, my life, and where I test a bunch of cool stuff!">
<meta name="author" content="Name">
<title id="title">Bootstrap | JavaScript Test</title>
<!--Stylesheets (Bootstrap v3.5.5)-->
<link rel="stylesheet" href="../CSS/bootstrap.min.css" />
<link href="../CSS/BodyForm.css" rel="stylesheet" />
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<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="/">Logo</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="/">HOME</a></li>
<li><a href="#about">ABOUT</a></li>
<li><a href="#projects">PROJECTS</a></li>
<li><a href="#blog">BLOG</a></li>
<li><a href="#contact">CONTACT</a></li>
</ul>
</div>
</div>
</nav>
<div class="container body-content">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div>
<!-- Controls -->
<a class="left carousel-control" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="row">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<p class="text-center " id="padjust">Lorem ipsum dolor</p>
<p id="contact" class="text-center">Non-adjustable text. Should be centered tho. Lorem ipsum</p>
</div>
</div>
</div>
</div>
<footer class="panel-footer">
<div class="col-xs-6 col-sm-3 col-md-3">
<select id="font" class="form-control">
<option value="12">Size 12</option>
<option value="14">Size 14</option>
<option value="18">Size 18</option>
<option value="24">Size 24</option>
<option value="36">Size 36</option>
</select>
</div>
<input type="button" onclick="setFont()" value="Change font" class="btn btn-primary" />
</footer>
<!--JavaScript Custom and Bootstrap v3.5.5-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="../JavaScript/bootstrap.min.js"></script>
<script src="../JavaScript/Testing.js"></script>
</body>
</html>
&#13;
答案 0 :(得分:1)
重新组织我的html文档后,我遇到了同样的问题。我通过将这个Bootstrap JavaScript CDN脚本放入正文而不是头部来解决它。
<body>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
希望这有助于解决您的问题。