Forums

Scroll to top problems with function

tomaszciti 05 Mar, 2015
Hi

I'm having problems with my form, which is quite long.

Basically I want to add a function that will scroll to top where "Thanks message" is displayed after submission. At the moment you need to scroll up quite a lot to see it.

I have read a lot of posts and tried few ways, but can't get it to work.

My form ID is "#chronoform-update-details".

I have tried to use the following:

Load Javascript


jQuery(document).ready(function($){
$('html, body').animate({
        scrollTop: $("#chronoform-update-details").offset().top
    }, 1000);
});


I have put it in "ON SUBMIT" and tried to load it first or last. In both ways - the above code doesn't work.

And tried a solution found in FAQs - http://www.chronoengine.com/faqs/57-cfv4/cfv4-actions/2653-how-can-i-show-a-thanks-message-if-i-use-the-plug-in-or-module.html

I have changed my "Thanks message" to:

Custom Code


<div id='form_thanks_message' >
Thank you . . . // your message goes here
</div>


and then added

Load Javascript in ON SUBMIT last position (after Custom Code with "Thanks message").


jQuery(document).ready(function($){
jQuery('#form_thanks_message')[0].scrollIntoView();
});


This doesn't work too for me. 😟


Can anyone, please help with this?
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger