Prevent page from auto scrolling

  • Profile Image
    reciproc8
    Asked on July 20, 2013 at 08:58 PM

    Hey guys

    On embedded forms that have page breaks, when you hit next, it changes the scrolled position of the page to center the webform.  I have content above my webform.  I have page breaks between each question and I want my content to always be visible.  But for some reason this problem happens and it puts the webform at the top or automatically scrolls the page.  How can this be prevented?

  • Profile Image
    EltonCris
    Answered on July 20, 2013 at 09:23 PM

    Hi,

    Try adding ?nojump at the end part of the form URL found in your embed code.

    Example,

    If you are embedding your form as script:

    <script type="text/javascript" src="//form.jotformpro.com/jsform/32002213563943?nojump"></script>

    And, if it's iframe, follow this:

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotformpro.com/form/32002213563943?nojump" frameborder="0" style="width:100%; height:738px; border:none;" scrolling="no"></iframe>

    Let us know if this doesn't help.

    Thanks!

  • Profile Image
    reciproc8
    Answered on July 22, 2013 at 03:28 PM

    Work great thanks

  • Profile Image
    reciproc8
    Answered on July 31, 2013 at 01:56 PM

    Hey

    I just tried this on another form and it is now working.  I added the ?nojump and it is not working.

     

    Here is the iFrame code

    iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotform.co/form/31925424748864?nojump" frameborder="0" style="width:100%; height:954px; border:none;" scrolling="no"></iframe>

    <script type="text/javascript">window.handleIFrameMessage = function(e) {var args = e.data.split(":");var iframe = document.getElementById("JotFormIFrame");if (!iframe)return;switch (args[0]) {case "scrollIntoView":iframe.scrollIntoView();break;case "setHeight":iframe.style.height = args[1] + "px";break;}};if (window.addEventListener) {window.addEventListener("message", handleIFrameMessage, false);} else if (window.attachEvent) {window.attachEvent("onmessage", handleIFrameMessage);}</script

  • Profile Image
    Welvin
    Answered on July 31, 2013 at 03:10 PM

    Hi,

    Please use just this codes:

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotform.co/form/31925424748864?nojump" frameborder="0" style="width:100%; height:954px; border:none;" scrolling="no"></iframe>

     

    Thanks

  • Profile Image
    reciproc8
    Answered on July 31, 2013 at 06:19 PM

    Worked.

     

    Now I need to use it for other forms.  How do I get this code?  The iFrame code I get shows up as the one I pasted in before.

    Also, is an iFrame embed better than javascript?

  • Profile Image
    Goldo
    Answered on July 31, 2013 at 07:20 PM

    You can use the above code and just the change the form source url. You can adjust the width and height to suit your website.

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="http://form.jotform.co/form/31925424748864?nojump" frameborder="0" style="width:100%; height:954px; border:none;" scrolling="no"></iframe>

    We prefer iFrame as it avoid code conflicts.

  • Profile Image
    reciproc8
    Answered on September 23, 2013 at 07:19 PM

    Whenever I use this code on other forms it shows the error:

    Invalid Form URL

    This form is not available for this domain.

     

    Dafaq? 

  • Profile Image
    Cesar
    Answered on September 23, 2013 at 07:55 PM

    You can use the code shown by Goldo, on other forms, just make sure the the src="" matches the URL you would use to access the stand-alone form.

    Kindly let us know if the issue persists. Thank you.

  • Profile Image
    reciproc8
    Answered on September 23, 2013 at 07:56 PM

    I have tried using that code multiple times with the correct URL and it never works anymore

  • Profile Image
    pinoytech
    Answered on September 23, 2013 at 08:28 PM

    Hi,

    Can you please share to us the URL of your website where your form is embedded for further assistance?

    Thank you!