mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
Make the log auto-scroll if the scrollbar is near the bottom, but maintain position if it isn't.
This commit is contained in:
parent
a1d654c010
commit
22538d6697
1 changed files with 9 additions and 1 deletions
|
@ -194,9 +194,17 @@ function clear(ctx) {
|
|||
ctx.restore();
|
||||
}
|
||||
|
||||
/* Auto-scroll if the scrollbar is near the bottom, otherwise do
|
||||
nothing. */
|
||||
function checkScrolling() {
|
||||
if ((stdout.scrollHeight - stdout.scrollTop) <= stdout.offsetHeight) {
|
||||
stdout.scrollTop = stdout.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
function log(str) {
|
||||
stdout.innerHTML += str;
|
||||
window.scrollTo(0, stdout.getBoundingClientRect().bottom);
|
||||
checkScrolling();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue