luci-theme-bootstrap: dynamically adjust body margin
Fixes: #3722 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
eed3edfe6b
commit
c99684dff7
1 changed files with 15 additions and 0 deletions
|
@ -98,6 +98,13 @@
|
||||||
ul.style.display = '';
|
ul.style.display = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function adjust_body_margin(ev) {
|
||||||
|
var body = document.querySelector('body'),
|
||||||
|
head = document.querySelector('header');
|
||||||
|
|
||||||
|
body.style.marginTop = head.offsetHeight + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('luci-loaded', function(ev) {
|
document.addEventListener('luci-loaded', function(ev) {
|
||||||
var tree = <%= luci.http.write_json(luci.dispatcher.menu_json() or {}) %>,
|
var tree = <%= luci.http.write_json(luci.dispatcher.menu_json() or {}) %>,
|
||||||
node = tree,
|
node = tree,
|
||||||
|
@ -114,6 +121,14 @@
|
||||||
if (node)
|
if (node)
|
||||||
render_tabmenu(node, url);
|
render_tabmenu(node, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener('poll-start', adjust_body_margin);
|
||||||
|
document.addEventListener('poll-stop', adjust_body_margin);
|
||||||
|
document.addEventListener('uci-new-changes', adjust_body_margin);
|
||||||
|
document.addEventListener('uci-clear-changes', adjust_body_margin);
|
||||||
|
window.addEventListener('resize', adjust_body_margin);
|
||||||
|
|
||||||
|
adjust_body_margin(ev);
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue