尝试向我正在处理的网站添加下拉概念验证。使用bootswatch中的Minty主题。单击时下拉不会扩展。我似乎引用了正确的js脚本。按顺序jQuery和Bootstrap。
<div class="collapse navbar-collapse" id="navbarColor01">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
@Html.ActionLink("Home", "Index", "Home", null, new { @class = "nav-link" })
</li>
<li class="nav-item">
@Html.ActionLink("About", "About", "Home", null, new { @class = "nav-link" })
</li>
<li class="nav-item">
@Html.ActionLink("Contact", "Contact", "Home", null, new { @class = "nav-link" })
</li>
<li class="nav-item">
<p>@Html.ActionLink("All Products", "Index", "Products", null, new { @class = "nav-link" })</p>
</li>
<li class="nav-item">
<p>@Html.ActionLink("Supplements", "Supplements", "Products", null, new { @class = "nav-link" })</p>
</li>
<li class="nav-item">
<p>@Html.ActionLink("Protein Bars", "ProteinBars", "Products", null, new { @class = "nav-link" })</p>
</li>
<li class="nav-item">
<p>@Html.ActionLink("Workouts", "Workouts", "Products", null, new { @class = "nav-link" })</p>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</nav>
这是捆绑包配置代码
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.min.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/Bootswatch.Minty.min.css",
"~/Content/font-awesome.min.css",
"~/Content/site.css"));
}
这是为关闭正文标记之前的视图生成的html。
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/bootstrap.min.js"></script>