mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-20 00:20:44 +08:00
better auto scrolling.
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user