From a22ae2818c3dfdd5039222dc2fc0a7bde7c29036 Mon Sep 17 00:00:00 2001 From: Spreadyy Date: Tue, 27 Sep 2016 11:41:47 +0200 Subject: [PATCH] Fix scroll JS for xkcd. Fix wrong scroll.height for xkcd. Solution according to: http://stackoverflow.com/questions/1145850/how-to-get-height-of-entire-document-with-javascript --- qutebrowser/javascript/scroll.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qutebrowser/javascript/scroll.js b/qutebrowser/javascript/scroll.js index fa0f311b3..9da413136 100644 --- a/qutebrowser/javascript/scroll.js +++ b/qutebrowser/javascript/scroll.js @@ -61,12 +61,13 @@ window._qutebrowser.scroll = (function() { funcs.pos = function() { var elem = document.documentElement; + var body = document.body; var pos = { "px": {"x": window.scrollX, "y": window.scrollY}, "scroll": { - "width": elem.scrollWidth, - "height": elem.scrollHeight, + "width": Math.max(body.scrollWidth, body.offsetWidth, elem.scrollWidth, elem.offsetWidth), + "height": Math.max(body.scrollHeight, body.offsetHeight, elem.scrollHeight, elem.offsetHeight), }, "inner": { "width": window.innerWidth,