我面临一个奇怪的问题,我不明白是什么原因造成的。也许有人可以帮助我?我试图在我的网站上应用滚动导航框架..
一切都已经按照我的意愿设置好了,设计和东西,唯一的问题是我不能在导航栏中让下拉菜单的特定元素处于活动状态(选中)。
我有我的正常导航栏链接,然后在最后一个菜单链接上我有一个链接,其中包含一个下拉列表,其中包含用户可以选择以更改网站语言的语言列表。
问题是我将类活动设置为与页面所选语言相对应的下拉元素,在我的最终 html 中我只看到 English,它不包含 li 类上的“活动”标签,为什么会发生这种情况?
这是因为我不能在导航栏中激活多个项目?我尝试使用 Chrome Inspect Element 添加“活动”,我可以看到样式上的“活动类”差异......
这是我的html代码,它可能会有所帮助:
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">
<!-- Navigation -->
<nav class="nav-justified navbar navbar-default navbar-fixed-top navbar-inverse" role="navigation">
@*<div class="container">*@
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<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 page-scroll" href="#page-top">Start Bootstrap</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse">
<div class="navbar-ex1-collapse">
<ul class="nav nav-justified">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li>@Html.ActionLink(@Model.Bio[CultureInfo.CurrentCulture].ToString(), "Index", "Home", null, new { @class = "navBarLinks page-scroll", @href = "#intro" })</li>
<li><a href="#about" class="page-scroll navBarLinks">@Model.Disco[CultureInfo.CurrentCulture]</a></li>
<li><a href="#services" class="page-scroll navBarLinks">@Model.Gallery[CultureInfo.CurrentCulture]</a></li>
<li><a href="#contact" class="page-scroll navBarLinks">@Model.Tour[CultureInfo.CurrentCulture]</a></li>
<li><a class="page-scroll navBarLinks">@Model.Video[CultureInfo.CurrentCulture]</a></li>
@{ListDictionary languages = (ListDictionary)Model.Languages[CultureInfo.CurrentCulture.ToString()];}
<li class="dropdown">
<a href="#" class="dropdown-toggle navBarLinks" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">@languages[CultureInfo.CurrentCulture.ToString()]<span class="caret"></span></a>
<ul class="dropdown-menu">
@foreach (var languageKey in languages.Keys)
{
if (languageKey.ToString() == Model.SelectedLanguage)
{
<li class="active">
@Html.ActionLink(languages[languageKey.ToString()].ToString(), "Start", "Home", new { lang = languageKey }, null)
</li>
}
else
{
<li>
@Html.ActionLink(languages[languageKey.ToString()].ToString(), "Start", "Home", new { lang = languageKey }, null)
</li>
}
}
</ul>
</li>
</ul>
</div>
</div>
<!-- /.navbar-collapse -->
@*</div>*@
<!-- /.container -->
</nav>
<!-- Intro Section -->
<section id="intro" class="intro-section">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>Scrolling Nav</h1>
<p><strong>Usage Instructions:</strong> Make sure to include the <code>scrolling-nav.js</code>, <code>jquery.easing.min.js</code>, and <code>scrolling-nav.css</code> files. To make a link smooth scroll to another section on the page, give the link the <code>.page-scroll</code> class and set the link target to a corresponding ID on the page.</p>
<a class="btn btn-default page-scroll" href="#about">Click Me to Scroll Down!</a>
</div>
</div>
</div>
</section>
<!-- About Section -->
<section id="about" class="about-section">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>About Section</h1>
</div>
</div>
</div>
</section>
<!-- Services Section -->
<section id="services" class="services-section">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>Services Section</h1>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="contact-section">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>Contact Section</h1>
</div>
</div>
</div>
</section>
非常感谢您提前提供的帮助!