Blog, Website & Page Publishing

zanders
Miembro

Anchor Links Not Working In Header Menu Item

resolver

When I inspect the URL it is correct, but the link is not clickable on web or mobile. Visit skilltype.com and hover over the How It Works menu items to see what i'm referring to.Screen Shot 2021-09-22 at 11.36.31 AM.png

0 Me gusta
1 Soluciones aceptada
Teun
Solución
Experto reconocido | Partner nivel Diamond
Experto reconocido | Partner nivel Diamond

Anchor Links Not Working In Header Menu Item

resolver

Hi @zanders ,

 

It seems that your main.js script is causing an issue. I get the following error in the console when I click on a link:


main.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'top')
at HTMLAnchorElement.<anonymous> (main.js:1)
at HTMLAnchorElement.dispatch (jquery-1.12.4.min.js:3)
at HTMLAnchorElement.r.handle (jquery-1.12.4.min.js:3)

 

Do you have experience in coding? You should remove the faulty function or replace it. `window.scrollTo` could be used instead, you can set the 'behaviour' param to 'smooth' to animate the scrolling.
You could also add smooth-scroll with the following script tag:

<script src="https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll@15/dist/smooth-scroll.polyfills.min.js"></script>

 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Ver la solución en mensaje original publicado

1 Respuesta 1
Teun
Solución
Experto reconocido | Partner nivel Diamond
Experto reconocido | Partner nivel Diamond

Anchor Links Not Working In Header Menu Item

resolver

Hi @zanders ,

 

It seems that your main.js script is causing an issue. I get the following error in the console when I click on a link:


main.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'top')
at HTMLAnchorElement.<anonymous> (main.js:1)
at HTMLAnchorElement.dispatch (jquery-1.12.4.min.js:3)
at HTMLAnchorElement.r.handle (jquery-1.12.4.min.js:3)

 

Do you have experience in coding? You should remove the faulty function or replace it. `window.scrollTo` could be used instead, you can set the 'behaviour' param to 'smooth' to animate the scrolling.
You could also add smooth-scroll with the following script tag:

<script src="https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll@15/dist/smooth-scroll.polyfills.min.js"></script>

 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.