I am using Gravity Forms for a one-page website I am developing: http://www.joshrodg.com/polio. There are two forms, both at the bottom of the page (Join and Contact).
I discovered some code that would enable anchors on the form - add_filter("gform_confirmation_anchor", create_function("","return true;"));
, so that after the form has been submitted the page scrolls back to the form position on the page - Gravity forms adds #gf_1
or #gf_2
to the form action so that it redirects to a specific anchor link (that is generated by gravity forms).
The problem I am having is the form redirects to odd places on the page when viewing on smaller screens. The Join form, gets redirected to the middle of the picture gallery and the Contact form gets redirected to the middle of the links section. I am guessing this is partly because of the way the sections are slanted on the page, but that's just a guess.
I would like to fix the out of the box behavior (if possible), I may need to adjust something on my end.
Another idea I had was to use jQuery to find the specific form action id and change it to something else like #join
or #contact
(which would redirect to the titles of those sections), but I'm not entirely sure that would work either. UPDATE - I tried to do this, but the page still redirects to an odd position when submitted on smaller screens $('#join form').attr('action', '/polio/#join');
Does anyone have any ideas of what's happening or a possible fix I could use to correct the behavior? - I'm not really sure the cause
Thanks,
Josh