mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-19 16:01:57 +08:00
better auto scrolling.
This commit is contained in:
@@ -143,7 +143,11 @@
|
|||||||
});
|
});
|
||||||
updateSummary($form, messages);
|
updateSummary($form, messages);
|
||||||
if (errors.length) {
|
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 {
|
} else {
|
||||||
data.validated = true;
|
data.validated = true;
|
||||||
var $button = data.submitObject || $form.find(':submit:first');
|
var $button = data.submitObject || $form.find(':submit:first');
|
||||||
|
|||||||
Reference in New Issue
Block a user