fix(toc): restore correct floating TOC positioning after layout refactor

Fix incorrect TOC alignment caused by outdated DOM selector in toc.js.
The content reference element changed during layout refactor, breaking
position calculations for the floating TOC.

Updated contentColumn selector to use .main-wrapper/.container fallback,
ensuring correct left offset and responsive positioning.

Also adds a more robust fallback chain to prevent future regressions
when layout structure changes.
This commit is contained in:
2026-04-26 04:43:04 +02:00
parent 4408a738ec
commit 05de6f2028
3 changed files with 36 additions and 8 deletions
+8 -7
View File
@@ -1,6 +1,8 @@
document.addEventListener('DOMContentLoaded', function () {
var toc = document.getElementById('zeitfresser-floating-toc');
var title = document.querySelector('.zeitfresser-article-heading .page-title, .zeitfresser-article-heading .entry-title, .entry-header .entry-title');
var title = document.querySelector(
'.entry-header .entry-title, .page-title, h1'
);
var progressBar = document.getElementById('zeitfresser-floating-toc-progress');
var nav = toc ? toc.querySelector('.zeitfresser-floating-toc__nav') : null;
@@ -67,12 +69,11 @@ document.addEventListener('DOMContentLoaded', function () {
var titleRect = title.getBoundingClientRect();
var scrollTop = window.scrollY || window.pageYOffset || 0;
var contentColumn = document.querySelector(
'.inside-page .main-wrapper > *:first-child, ' +
'.inside-page .main-wrapper .primary-content, ' +
'.inside-page .main-wrapper #primary, ' +
'.inside-page .main-wrapper main'
);
var contentColumn =
document.querySelector('.inside-page .container') ||
document.querySelector('#primary') ||
document.querySelector('.content-area') ||
title;
var sidebar = document.querySelector(
'.inside-page .main-wrapper > aside, ' +