From 8c424e5e9562ae18b89af4ad8b513843e952738c Mon Sep 17 00:00:00 2001 From: Jake Probst Date: Sun, 11 Mar 2012 06:24:31 -0700 Subject: [PATCH] not terrible autoscrolling in add card window --- aqt/editor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aqt/editor.py b/aqt/editor.py index bf23e6ba1..a00c46af0 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -97,7 +97,11 @@ function onFocus(elem) { } while (obj = obj.offsetParent); 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