'Highlight current link with Swup.js

I use Swup for page transitions and was wondering how I could highlight the currently active link. Imagine I have a page structure like:

<nav>
  <a href="/page-1">Page 1</a>
  <a href="/page-2">Page 2</a>
</nav>
<main id="swup">
  <!-- content -->
</main>

After each nav a click, the page content is being replaced, but I want to have a different style for the currently active link.

Thanks for any help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source