From 2e75553284de508c918a8e7d779ea1db194d3527 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 4 Jun 2023 14:17:51 -0700 Subject: [PATCH] Fix img_centerline by not relying on offsetparent. --- voussoir.net/photography/generate_site.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voussoir.net/photography/generate_site.py b/voussoir.net/photography/generate_site.py index 8ad518e..9bba902 100644 --- a/voussoir.net/photography/generate_site.py +++ b/voussoir.net/photography/generate_site.py @@ -263,7 +263,7 @@ def write_directory_index(directory): } function scroll_to_img(img) { - const img_centerline = img.offsetParent.offsetTop + img.offsetTop + (img.offsetHeight / 2); + const img_centerline = img.getBoundingClientRect().top + img.ownerDocument.defaultView.pageYOffset + (img.offsetHeight / 2); // document.body.scrollTop = img_centerline - (window.innerHeight / 2); desired_scroll_position = Math.round(img_centerline - (window.innerHeight / 2)); scroll_step();