Skip to content

Commit 40fc297

Browse files
committed
Javascript fix, offsetParent can be null when not visible
1 parent 9ce833f commit 40fc297

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

html/template_navigation.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ window.addEventListener('DOMContentLoaded', () => {
6969
}
7070

7171
// center sidebar to active topic
72-
const bounds = active_topic.offsetParent.getBoundingClientRect();
73-
active_topic.offsetParent.scrollTop = active_topic.offsetTop - bounds.height/2;
72+
if (active_topic.offsetParent) {
73+
const bounds = active_topic.offsetParent.getBoundingClientRect();
74+
active_topic.offsetParent.scrollTop = active_topic.offsetTop - bounds.height/2;
75+
}
7476
}
7577
});

0 commit comments

Comments
 (0)