Skip to content
Snippets Groups Projects
Commit bf90e369 authored by Thomas Hackl's avatar Thomas Hackl
Browse files

Revert "check for sidebar existence, fixes #2918"

This reverts commit 8e113dee.
parent e6333ec4
No related branches found
No related tags found
No related merge requests found
...@@ -2,11 +2,8 @@ const Sidebar = { ...@@ -2,11 +2,8 @@ const Sidebar = {
place() { place() {
const header = document.getElementById('main-header'); const header = document.getElementById('main-header');
const sidebar = document.getElementById('sidebar'); document.getElementById('sidebar').style.top =
if (sidebar) { header.offsetTop + header.offsetHeight + 'px';
sidebar.style.top =
header.offsetTop + header.offsetHeight + 'px';
}
}, },
observeSidebar() { observeSidebar() {
...@@ -19,11 +16,8 @@ const Sidebar = { ...@@ -19,11 +16,8 @@ const Sidebar = {
/** /**
* Observe if sidebar fits into viewport. * Observe if sidebar fits into viewport.
*/ */
const sidebar = document.getElementById('sidebar'); const sObserver = new IntersectionObserver(STUDIP.Sidebar.fits, options);
if (sidebar) { sObserver.observe(document.getElementById('sidebar'));
const sObserver = new IntersectionObserver(STUDIP.Sidebar.fits, options);
sObserver.observe();
}
}, },
observeBody() { observeBody() {
...@@ -93,20 +87,18 @@ const Sidebar = { ...@@ -93,20 +87,18 @@ const Sidebar = {
footerVisible(entries, observer) { footerVisible(entries, observer) {
const sidebar = document.getElementById('sidebar'); const sidebar = document.getElementById('sidebar');
if (sidebar) { entries.forEach(entry => {
entries.forEach(entry => { // Footer is visible on current page.
// Footer is visible on current page. if (entry.isIntersecting) {
if (entry.isIntersecting) { if (sidebar.classList.contains('no-footer')) {
if (sidebar.classList.contains('no-footer')) { sidebar.classList.remove('no-footer');
sidebar.classList.remove('no-footer');
}
} else {
if (!sidebar.classList.contains('no-footer')) {
sidebar.classList.add('no-footer');
}
} }
}); } else {
} if (!sidebar.classList.contains('no-footer')) {
sidebar.classList.add('no-footer');
}
}
});
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment