mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix scrollable term issue on startup
This commit is contained in:
parent
63347f956b
commit
084cb8b71c
@ -196,8 +196,12 @@
|
||||
function new_line_handler(data) {
|
||||
$('#virt_console').append(data.line)
|
||||
const elem = document.getElementById('virt_console');
|
||||
if (!scrolled) {
|
||||
scrollConsole()
|
||||
try{
|
||||
if (!scrolled) {
|
||||
scrollConsole();
|
||||
}
|
||||
}catch{
|
||||
scrollConsole();
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,7 +302,6 @@
|
||||
|
||||
const chkScroll = (e) => {
|
||||
const elem = $(e.currentTarget);
|
||||
|
||||
if (Math.round(elem[0].scrollHeight - elem.scrollTop()) <= elem.outerHeight()) {
|
||||
document.getElementById("to-bottom").style.visibility = "hidden";
|
||||
scrolled = false;
|
||||
@ -316,7 +319,7 @@
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
var scrolled;
|
||||
var scrolled = false;
|
||||
$('#virt_console').on('scroll', chkScroll);
|
||||
$('#to-bottom').on('click', scrollToBottom)
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user