Commit b3d83e66 authored by geertvd's avatar geertvd Committed by Jelle Sebreghts
Browse files

Issue #2737525 by geertvd: "Scroll to error message"-feature doesn't scroll to...

Issue #2737525 by geertvd: "Scroll to error message"-feature doesn't scroll to the right position when the first element is hidden
parent 5c456132
......@@ -397,7 +397,21 @@
x = $("#" + errorel).offset().top - $("#" + errorel).height() - 100; // provides buffer in viewport
}
else {
x = $(validator.errorList[0].element).offset().top - $(validator.errorList[0].element).height() - 100;
var first_element = $(validator.errorList[0].element);
var hidden_element = first_element.is(":hidden");
if (hidden_element) {
var original_visibility = first_element.css('visibility');
var original_position = first_element.css('position');
first_element.css('visibility', 'hidden');
first_element.css('position', 'absolute');
first_element.show();
}
x = first_element.offset().top - first_element.height() - 100;
if (hidden_element) {
first_element.hide();
first_element.css('position', original_position);
first_element.css('visibility', original_visibility);
}
}
$('html, body').addClass('cv-scrolling').animate(
{scrollTop: x},
......
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