From: Joey Schulze Date: Mon, 4 Jun 2018 18:23:29 +0000 (+0200) Subject: Adjust centering of objects when page is scrolled X-Git-Url: https://git.infodrom.org/?p=infodrom.org%2Fservice.infodrom.org;a=commitdiff_plain;h=c0b3d2bb398bbcfa30a6250e2629612a47a6be99;ds=sidebyside Adjust centering of objects when page is scrolled --- 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");