How to scroll to div on frontity?

Hello, how to scroll to div on frontity?

I am trying to create div like this:

<div id="name_of_div">

And in frontity.settings.js file add this:
menu: [
[“Home”, “/#name_of_div”],

But nothing happens.
Maybe you have an idea how to do it?

You could use scrollIntoView
I use it to scroll the user down to an apply now form.

https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

You could put it in a useEffect hook so when the component renders, it slides down to a page

1 Like

Hi @andrius.zibaitis96 and @gatewayweb,

Welcome to the Community!

@andrius.zibaitis96
Yes, this is more a React issue than a Frontity issue

As @gatewayweb suggests using scrollIntoView in combination with React references is the way to do it

A quick look on the web can give you some ideas on how to apply this