我当前正在创建一个导航菜单,我希望诸如“印刷术”之类的子部分在单击它们并加载新页面后在菜单中保持打开状态。
我如何最好地完成这项任务
这是我用于导航菜单的HTML代码。
<div class="sidenav">
<a class="current3" href="index.html">Home</a>
<a href="https://robertevansuni.uk/Journal/">Journal</a>
<button class="dropdown-btn">Davids Work
<i class="fa fa-caret-down" aria-hidden="true"></i>
</button>
<div class="dropdown-container">
<a class="dropdowntext2" href="three-designed-objects-homepage.html">Designed Objects</a>
<!--
<a href="#">Link 2</a>
<a href="#">Link 3</a>
-->
</div>
<button class="dropdown-btn">Priscas Work
<i class="fa fa-caret-down" aria-hidden="true"></i>
</button>
<div class="dropdown-container">
<a class="dropdowntext2" href="Typography-arrangement.html">Typography</a>
<a class="dropdowntext2" href="lithome.html">Literature</a>
<!-- <a href="#">Link 3</a> -->
</div>
<a class="submenu"href="oldwebsites.html">Archived Websites</a>
<a class="nav-menu" href="about.html">About</a>
<button class="openBtn" onclick="openSearch()">Search</button>
</div>