jQuery Ajax return, scroll up to div error message container
Hi everyone
I'm AJAXifying a whole bunch of forms on our website and I'm using the BlockUI plugin.
That's working great.
I test the HTML that's returned from the AJAX call and if it contains the text "box_error" then I unblock the UI and output the returned HTML into a DIV above the form which displays the error message to the user.
If it contains "box_success" then I unblock the UI, animate the form away and animate the success message in the form's place. Really creates a great effect and provides excellent user feedback.
For particularly long forms, or people with a small vertical resolution, then the user doesn't see the error message inserted above the form as the viewport will be centered over the submit button they pressed. The error message is
Is there any way for me to smooth-scroll the viewport up to the DIV that the error message was inserted into?
I've seen a smooth scroll effect on sites before so I assume there must be a jquery plugin to do something like this.
Is it possible?
Cheers, B