Form Submit Button redirect with smooth scroll

Hi Folks,

I have a form submit button that redirects to a section down the page using the ID #Results
This works, however the client has asked is there a way to apply a smooth scroll as opposed to a blunt click and you’re at the Results section.

Has anyone ever achieved this using custom JavaScript?

1 Like

Hey @Bammedia ,

You can add the following code inside the head tag of the custom code section of the page where you want to implement the smooth scroll.

<style>
  html {
    scroll-behavior: smooth;   
  }
</style>

I tested this out on a dummy site with a form redirect and it scrolls smoothly instead of jumping to the in-page section.

Hope this helps.

1 Like