not terrible autoscrolling in add card window

This commit is contained in:
Jake Probst 2012-03-11 06:24:31 -07:00
parent 51146ccd51
commit 8c424e5e95

View file

@ -97,7 +97,11 @@ function onFocus(elem) {
} while (obj = obj.offsetParent); } while (obj = obj.offsetParent);
return cur; return cur;
} }
window.scroll(0,pos(elem)-15); var y = pos(elem);
if ((window.pageYOffset+window.innerHeight) < (y+elem.offsetHeight))
window.scroll(0,y+elem.offsetHeight-window.innerHeight);
else if (window.pageYOffset > y)
window.scroll(0, y-15);
} }
// restore cursor // restore cursor