Skip to content

Instantly share code, notes, and snippets.

@techb
Created May 3, 2022 20:52
Show Gist options
  • Save techb/7f111732f97b73e4837664066b21bcd0 to your computer and use it in GitHub Desktop.
Save techb/7f111732f97b73e4837664066b21bcd0 to your computer and use it in GitHub Desktop.
Gravity Forms stop scrolling on multi-page ajax forms

When using a gravity form (multi-page, ajax) as a sticky modal for the bottom of the page, the generated anchor tag used to scroll interfears with the page scrolling.

The effect is when the user clicks the next button, the new page loads via ajax in the modal, but the gf js is trying to scroll to the top where the generated anchor tag is. But that's at the bottom of the page, so the page will auto scroll trying to keep up.

We can disable this behaviour with hooks. Add this to your themes function.php

Global disable add_filter( 'gform_confirmation_anchor', '__return_false' );

Per form ID: Example form id of 5 add_filter( 'gform_confirmation_anchor_5', '__return_false' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment