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 );