poc #21: add a fixed menu on the left

This commit is contained in:
Simon Vieille
2020-09-02 19:09:37 +02:00
parent 2fc9a4effe
commit 361ad9211c
2 changed files with 86 additions and 0 deletions
+46
View File
@@ -20,6 +20,8 @@
if (apps.length === 0) {
sideMenu.removeClass('open')
sideMenuOpener.addClass('hide')
sideMenu.remove()
body.style.left = 0;
} else {
sideMenuOpener.removeClass('hide')
}
@@ -109,4 +111,48 @@
<?php require_once __DIR__.'/_topMenuApps.js'; ?>
<?php endif; ?>
window.setTimeout(function() {
var elements = document.querySelectorAll('*');
var fixedElements = []
for (var i in elements) {
var element = elements[i]
if (typeof element !== 'object') {
continue
}
var position = window.getComputedStyle(element, null).getPropertyValue('position');
if (position !== 'fixed') {
continue
}
if (element.getAttribute('id') === 'header') {
continue
}
if (element.getAttribute('id') === 'side-menu') {
continue
}
fixedElements.push(element)
}
window.setTimeout(function() {
for (var i in fixedElements) {
var element = fixedElements[i]
var value = window.getComputedStyle(element, null).getPropertyValue('left')
if (value === 'initial') {
continue
}
element.style.setProperty('left', 'initial')
element.style.setProperty('transform', 'translateX(' + value + ')')
}
}, 100);
}, 500);
})();