Jump to content

Blog Category underline active link in filter

Go to solution Solved by tuanphan,

Recommended Posts

  • Replies 1
  • Views 417
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution
Posted

You can use this code to Website Tools > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
  $(document).ready(function() {
    const url = window.location.href;

    if (url.includes('/tag/ALLE')) {
        $('body').addClass('alle');
    } else if (url.includes('/Private+Living')) {
        $('body').addClass('private-living');
    } else if (url.includes('/tag/Real+Estate')) {
        $('body').addClass('real-estate');
    }
});
</script>
<style>
  body.real-estate li.archive-group a[href*="/tag/Real+Estate"] {
    border-bottom: 1px solid #000;
}
  body.private-living li.archive-group a[href*="/tag/Private+Living"] {
    border-bottom: 1px solid #000;
}
  body.alle li.archive-group a[href*="/tag/ALLE"] {
    border-bottom: 1px solid #000;
}
</style>

image.png.9af0024407b34f36bb33855d46a18616.png

In the future, if you want to use Filter Links on Portfolio Page, you can also use this solution, instead of creating blog page

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.