From 718ace5d3d23b3551933fc1fbf5b608fc6a52c56 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Fri, 24 Jun 2022 23:41:56 -0300 Subject: [PATCH] Adjust debug log scroll position Signed-off-by: RD WebDesign --- scripts/pi-hole/js/debug.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/debug.js b/scripts/pi-hole/js/debug.js index d1699cf1..9d1d1c61 100644 --- a/scripts/pi-hole/js/debug.js +++ b/scripts/pi-hole/js/debug.js @@ -39,8 +39,9 @@ function eventsource() { "message", function (e) { ta.append(e.data); - // scroll page to the bottom (to the last received data) - $("html, body").scrollTop($(document).height()); + // scroll to the bottom of #output (most recent data) + var taBottom = ta.offset().top + ta.outerHeight(true); + $("html, body").scrollTop(taBottom - $(window).height()); }, false );