This question has been answered by Henrik Nielsen. See the first response.
<script> $(document).ready(function () { var errorDiv = $('.error:not(:empty)').first(); var scrollPos = errorDiv.offset().top-150; $('html,body').animate({scrollTop: scrollPos}, 1500); }); </script>