Archived topic
Assign a class to link when I'm on the current page
1 reply · Started by Diogenes on December 19, 2022
Hello.
Is there a way to assign a class to a block of generateblocks when it is located on the current page?
I'm making a sticky bar at the bottom of the page (with generatepress elements). In it I have created several blocks with horizontal icons that are linked to certain pages of the website, I would like that when you visit the page that is linked to the icon, a border will be placed around the icon (or background) to indicate that I am in that page, in this way it would give a visual signal that I am there.
Something like that, like what happens to the navmenu, which changes the color of the link when it is on the current page.
I hope I have explained myself correctly.
I appreciate the help.
Hi there,
I'm sorry but this is out of the scope of GP premium support.
Here's a similar case that I found online, it should be helpful:
https://stackoverflow.com/questions/8185746/javascript-add-class-depending-on-current-url