The following jQuery code scrolls to the first error of the form:
$('html,body').stop().delay(500).animate({scrollTop: $errors.filter(":first").offset().top -30},'slow');
However, if I replaced $('html,body')the name with a container element, such as a div class $('.myDivClass')with a fixed positioning, it does not seem to work. It simply scrolls to random places up and down with each view. If the container element is something other than html, body, it does not seem to work correctly.
I cannot understand what I am doing wrong.
The css element of the container element looks like this (so you know what I mean):
.mcModalWrap1{
position:fixed;
top:0;
left:0;
width:100%;
padding:50px;
background-image:url(images/overlay.png);
overflow:auto;
z-index:999;
display:none;
}
I tried using position () instead of offset () for relative positioning, but that didn't help.
Thank!
Update: there seems to be no solution for this.
source