henhen
henhen

Reputation: 1205

scroll to an ID without using anchor tag or hash

I have an React application that uses hash history, but the problem is, the application currently has anchor tags with ID references so it can scroll to the specific ID. How can I make a scroll animation without using the Anchor tag and scroll to a specified ID?

Upvotes: 0

Views: 1154

Answers (1)

Dan Kreiger
Dan Kreiger

Reputation: 5516

You can use plain JavaScript - CodePen Demo


JQuery's animate() function is much less verbose when it comes to scrolling, but I understand if you don't want to import JQuery into a React project.

Upvotes: 1

Related Questions