From c0b3d2bb398bbcfa30a6250e2629612a47a6be99 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Mon, 4 Jun 2018 20:23:29 +0200 Subject: [PATCH] Adjust centering of objects when page is scrolled --- src/infodrom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infodrom.js b/src/infodrom.js index 6325fc0..11e5db1 100644 --- a/src/infodrom.js +++ b/src/infodrom.js @@ -73,7 +73,7 @@ function make_editable(selector) $.fn.center = function () { this.css("position","absolute"); - this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + + this.css("top", Math.max(0, ((window.innerHeight - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px"); this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()) + "px"); -- 2.20.1