Hi all,
I have this function, which should scroll animated to an anchor.
Does anyone know how I can activate this only after a form has been submitted?
I want to animate the scroll down to either id="error" or id="succes" - depending on the form was submitted with or withour errors.
So..
WITH errors, which I am checking in PHP, I want to scroll down to div id="error".
WITHOUT errors, I want to scroll down to div id="succes".
This is the bit of code:
function goToByScroll(id) {
$('html,body').animate({scrollTop:$("#"+id).offset().top}, 'slow');
}
How do I check if the form has been submitted, and then after the page has submitted to itself, call the function and scroll down to the approiate div?
Something like this:
if (isset($_POST['myform'])) && !empty($errors) {
// Then I want to use jquery to animate and scroll down to div id="error"
}
if (isset($_POST['myform'])) && empty($errors) {
// Then scroll down to the div with id="succes"
}
Sorry for the formatting problems :-/
:-)
Hope someone can help,
Klemme