Browse Source

better auto scrolling.

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
d0ba90c1e4
  1. 6
      framework/yii/assets/yii.activeForm.js

6
framework/yii/assets/yii.activeForm.js

@ -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');

Loading…
Cancel
Save