brohlson / gatsby-plugin-anchor-links

⚓ Gatsby plugin for using smooth scroll anchor links with a Gatsby Link component
https://www.npmjs.com/package/gatsby-plugin-anchor-links
MIT License
68 stars 22 forks source link

Scroll only works on second click #44

Open DennisKraaijeveld opened 3 years ago

DennisKraaijeveld commented 3 years ago

Hi!

I use this plugin on a FAQ page with on the top of the page a row of anchor links to different sections of the page. But when I click this anchor link, it jumps, without smooth scroll animation, it instantly jumps to the correct section. When I scroll back up and use the anchor link again, the scroll animation is working.

Is there something wrong with my component?

 <p className="tracking-widest text-mainPink-500">
                                    <AnchorLink
                                      to={`/veelgestelde-vragen/#${slice2.primary.title.text}`}
                                      title={slice2.primary.title.text}
                                    >
                                      {slice2.primary.title.text}
                                    </AnchorLink>
                                  </p>
doublejosh commented 2 years ago

Same. This plugin is consistently broken on the first click everywhere I've used it.

hasanshafiq29 commented 1 year ago

Same here, any solution?