我正在使用 Bootstrap 4 创建一个网站,对于我的导航栏,我正在为我的按钮使用药丸。我要解决的问题是,如果我在不同的选项卡上并刷新页面,它会跳回主页。对于那些使用标签而不是药片的人,我已经看到了许多解决方案。这是其他人通常为此类问题提供的我的代码片段:
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="nav nav-pills navbar-nav ml-auto" id="pills-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-education-tab" data-toggle="pill" href="#pills-education" role="tab" aria-controls="pills-education" aria-selected="false">Education</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-skills-tab" data-toggle="pill" href="#pills-skills" role="tab" aria-controls="pills-skills" aria-selected="false">Skills</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-activities-tab" data-toggle="pill" href="#pills-activities" role="tab" aria-controls="pills-activities" aria-selected="false">Activities</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-projects-tab" data-toggle="pill" href="#pills-projects" role="tab" aria-controls="pills-projects" aria-selected="false">Projects</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">Contact</a>
</li>
</ul>
</div>
如果你们中的一个人能帮助解决这个问题,将不胜感激......提前致谢!