diff --git a/4chan_x.user.js b/4chan_x.user.js index 134a45a15..50624da87 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3807,11 +3807,20 @@ thumb = a.firstChild; if (thumb.hidden) { rect = a.getBoundingClientRect(); - if (rect.top < 0) { - d.body.scrollTop += rect.top - 42; - } - if (rect.left < 0) { - d.body.scrollLeft += rect.left; + if ($.engine === 'webkit') { + if (rect.top < 0) { + d.body.scrollTop += rect.top - 42; + } + if (rect.left < 0) { + d.body.scrollLeft += rect.left; + } + } else { + if (rect.top < 0) { + d.documentElement.scrollTop += rect.top - 42; + } + if (rect.left < 0) { + d.documentElement.scrollLeft += rect.left; + } } return ImageExpand.contract(thumb); } else { diff --git a/script.coffee b/script.coffee index 3073dedbb..3bfdb6e1c 100644 --- a/script.coffee +++ b/script.coffee @@ -2907,8 +2907,12 @@ ImageExpand = thumb = a.firstChild if thumb.hidden rect = a.getBoundingClientRect() - d.body.scrollTop += rect.top - 42 if rect.top < 0 - d.body.scrollLeft += rect.left if rect.left < 0 + if $.engine is 'webkit' + d.body.scrollTop += rect.top - 42 if rect.top < 0 + d.body.scrollLeft += rect.left if rect.left < 0 + else + d.documentElement.scrollTop += rect.top - 42 if rect.top < 0 + d.documentElement.scrollLeft += rect.left if rect.left < 0 ImageExpand.contract thumb else ImageExpand.expand thumb