Commit d0ba90c1 by Qiang Xue

better auto scrolling.

parent 5e9c8cb7
......@@ -143,7 +143,11 @@
});
updateSummary($form, messages);
if (errors.length) {
$(window).scrollTop($form.find(errors.join(',')).first().offset().top);
var top = $form.find(errors.join(',')).first().offset().top;
var wtop = $(window).scrollTop();
if (top < wtop || top > wtop + $(window).height) {
$(window).scrollTop(top);
}
} else {
data.validated = true;
var $button = data.submitObject || $form.find(':submit:first');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment