mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 06:07:11 -05:00
make sure element is visible on focus change
This commit is contained in:
parent
91b37842d4
commit
b3fc9e8f8b
1 changed files with 8 additions and 0 deletions
|
|
@ -88,6 +88,14 @@ function onFocus(elem) {
|
||||||
$(elem).css("-webkit-user-select", "none");
|
$(elem).css("-webkit-user-select", "none");
|
||||||
setTimeout(function () { unfocusHack() }, 1);
|
setTimeout(function () { unfocusHack() }, 1);
|
||||||
py.run("focus:" + currentField.id.substring(1));
|
py.run("focus:" + currentField.id.substring(1));
|
||||||
|
function pos(obj) {
|
||||||
|
var cur = 0;
|
||||||
|
do {
|
||||||
|
cur += obj.offsetTop;
|
||||||
|
} while (obj = obj.offsetParent);
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
window.scroll(0,pos(elem)-15);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore cursor
|
// restore cursor
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue