OK, I'm sure I'm justing having a brain-fart after 2 weeks Honeymoon in Tuscany... by brains clear, and I'm googled out looking for keyw开发者_如何学Pythonords and how to do it, even scanned down the JQuery Valdate.js looking for the bit that does it...
What I want to do is this; but don't know where to start.
if ($("#errorMessage").exists()){
// Jump browser window down to #errorMessage.
}
You can animate it down, like this:
if ($("#errorMessage").length){
$("html, body").animate({ scrollTop: $("#errorMessage").position().top });
}
You can give it a try here, this just gives a nice transition to the element's positon.
scrollIntoView would probably solve your problems.
And .exists()
would be .length > 0
check scrollTop property. you will have to scroll to the position of the element
精彩评论