fix scroll delay

master
codeskyblue 8 years ago
parent dd0c7549cb
commit 48febc2a5d

@ -19,5 +19,5 @@ body {
}
.realtime-log {
height: 50em;
height: 15em;
}

@ -194,7 +194,7 @@
$("#modalTailf").modal({
show: true,
// keyboard: false,
backdrop: 'static',
// backdrop: 'static',
})
});
</script>

@ -198,8 +198,16 @@ $(function() {
vm.log.follow = false;
}
})
$('#modalTailf').on('hidden.bs.modal', function() {
// do something…
console.log("Hiddeen")
if (W.wsLog) {
console.log("close wsLog")
W.wsLog.close()
}
})
var ws = newWebsocket("/ws/logs/hee", {
W.wsLog = newWebsocket("/ws/logs/hee", {
onopen: function(evt) {
vm.log.content = "";
},
@ -208,7 +216,9 @@ $(function() {
vm.log.line_count = $.trim(vm.log.content).split(/\r\n|\r|\n/).length;
if (vm.log.follow) {
var pre = $(".realtime-log")[0];
pre.scrollTop = pre.scrollHeight;
setTimeout(function() {
pre.scrollTop = pre.scrollHeight - pre.clientHeight;
}, 1);
}
}
})

Loading…
Cancel
Save