Jump to content

Active State on Anchor Link using javascript 7.1

Recommended Posts

Site URL: https://objekts.squarespace.com/?password=demo

Hello! My anchor link is in the nav and I would like it to have the same active state as the other navs when it is clicked. I kinda figured it out using the class ".homepage" since the anchor link is in the homepage, but the active state is always on and I want it to be on only when clicked. I think javascript would be ideal for this problem.

The script would read the title and if it has "#" in the url then the active class would show, and if not, the active class would be removed. I'm not super great with javascript and would appreciate any help with this! Thanks in advance!

Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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.