mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-04-22 13:12:25 +02:00
Solved main size bug
This commit is contained in:
parent
20c4a4809b
commit
3284684282
@ -1,27 +1,19 @@
|
||||
function adjustScrollContainerHeight() {
|
||||
// Elemente ermitteln
|
||||
const headerEl = document.querySelector('header');
|
||||
const navEl = document.querySelector('nav');
|
||||
const footerEl = document.querySelector('footer');
|
||||
const mainEl = document.getElementById('main');
|
||||
if (!mainEl) return;
|
||||
const scrollContainer = mainEl.querySelector('.scroll-container');
|
||||
if (!scrollContainer) return;
|
||||
|
||||
const container = mainEl.parentElement;
|
||||
const scrollbarContainer = mainEl.parentElement.querySelector('#custom-scrollbar');
|
||||
let siblingsHeight = 0;
|
||||
|
||||
if (headerEl) {
|
||||
const headerRect = headerEl.getBoundingClientRect();
|
||||
siblingsHeight += headerRect.height;
|
||||
}
|
||||
if (navEl) {
|
||||
const navRect = navEl.getBoundingClientRect();
|
||||
siblingsHeight += navRect.height*2;
|
||||
}
|
||||
if (footerEl) {
|
||||
const footerRect = footerEl.getBoundingClientRect();
|
||||
siblingsHeight += footerRect.height;
|
||||
}
|
||||
Array.from(container.children).forEach(child => {
|
||||
if(child !== mainEl && child !== scrollContainer && child !== scrollbarContainer) {
|
||||
const style = window.getComputedStyle(child);
|
||||
const height = child.offsetHeight;
|
||||
const marginTop = parseFloat(style.marginTop) || 0;
|
||||
const marginBottom = parseFloat(style.marginBottom) || 0;
|
||||
siblingsHeight += height + marginTop + marginBottom;
|
||||
}
|
||||
});
|
||||
|
||||
// Verfügbare Höhe berechnen: Fensterhöhe minus Höhe der Geschwister
|
||||
const availableHeight = window.innerHeight - siblingsHeight;
|
||||
|
@ -33,9 +33,9 @@
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</main>
|
||||
<!-- Custom scrollbar element fixiert am rechten Rand -->
|
||||
<!-- Custom scrollbar element fixiert am rechten Rand -->
|
||||
<div id="custom-scrollbar">
|
||||
<div id="scroll-thumb"></div>
|
||||
<div id="scroll-thumb"></div>
|
||||
</div>
|
||||
{% set menu_type = "footer" %}
|
||||
{% include "moduls/navigation.html.j2" %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user