I'm in the process of creating a portfolio website where the index.html page features a sliding navigation bar that displays a collection of projects. Each project is linked to a separate work.html page. I would like the sliding nav to automatically open upon returning from a work.html page to the index.html page.
I appreciate any assistance with this!
The code snippet
document.querySelector(".work").click()
successfully opens the sliding nav, but I am unsure of how to specifically trigger this action only when returning from a project or work.html page.
Below is the navigation markup found on both the index.html and work.html pages:
<ul class="nav-list">
<li class="nav-item">
<a class="nav-link work" href=# onclick="openNav();showButton()">work</a>
</li>
<li class="nav-item">
<a class="nav-link" href="...">experience</a>
</li>
<li class="nav-item">
<a class="nav-link" href="..." rel="noopener noreferrer" target="_blank">blog</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">about</a>
</li>
</ul>
Upon returning to index.html, the '.work' link will automatically trigger the opening of the sliding nav.