Adjust centering of objects when page is scrolled
authorJoey Schulze <joey@infodrom.org>
Mon, 4 Jun 2018 18:23:29 +0000 (20:23 +0200)
committerJoey Schulze <joey@infodrom.org>
Sat, 6 Oct 2018 17:30:26 +0000 (19:30 +0200)
src/infodrom.js

index 6325fc0..11e5db1 100644 (file)
@@ -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");