posabsolute/jQuery-Validation-Engine — Issue #279: patch for left scroll in "overflown"
Author: lamuzzachiodi
Created: 2012-02-16 08:06:27+00:00
State: open

This patch fix the left scroll for overflown (breaks in 2.5).
This code complements the patch #278.
On function "_validateFields" within

if (options.isOverflown) {

instead of

scrollContainer.animate({ scrollTop: destination }, 1100, function(){
if(options.focusFirstField) first_err.focus();
});

could be

if(options.focusFirstField) first_err.focus();
fixleft=(positionType=='centerLeft')? 0:5000;
scrollContainer.animate({ scrollTop: destination,scrollLeft: fixleft}, 1100, function(){
$("html:not(:animated),body:not(:animated)").animate({scrollLeft:fixleft});
});

This support case of scroll of (overflown) div and/or scroll of page (specially when window isn´t maximized).
Basically, the container scroll completely to rigth (5000, an arbitrary large number) o to left (0). Isn´t completely exact but works for most cases.
Finally, focus() out of animation avoid certain scrolling mismatches, again, when the window isn't maximized.