Prevent form submit from causing page jump

Jack_Watson1
Tourist
24 0 1

Hi,

So I've moved the default signup form from its original location at the bottom of the page to the top (to make it look like it's embedded in the hero image). The issue I'm having is - when the user clicks the "subscribe" button the page jumps so that the "Thanks for subscribing!" message is at the top of the page. I'm trying to prevent this from happening, so the page stays where it was when the user clicks the button.

In the signup-form.liquid file there is the line:

{% if form.posted_successfully? %}
                   <h4>{{ 'layout.signup.post_success' | t }}</h4>
                   <script>window.scroll(0,1000000)</script>
{% else %}

I thought the <script>window.scroll(0,1000000)</script> would be responsible for the page jump, but deleting the <script> or changing the values seems to have no effect.

Does anyone know how to prevent this from happening? Thanks for any insight!

edit: interestingly if I use the Theme Editor to include the signup form in the header (which as I understand it calls the same code from the signup-form.liquid file), submitting the form causes the page to jump to the top (which is preferable, but I would rather it didn't jump at all). I can't figure out what piece of code is causing them to behave differently though.