summaryrefslogtreecommitdiffhomepage
path: root/themes
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-03-27 17:57:48 +0100
committerJo-Philipp Wich <jo@mein.io>2020-03-27 17:58:12 +0100
commitc99684dff73b4d0ca6f73cd3cde667f685aa5b4b (patch)
tree5a3be7ff66fd7d58a964b2421aaf63bebcc9845b /themes
parenteed3edfe6b0b04292be5000730fbb088703fc388 (diff)
luci-theme-bootstrap: dynamically adjust body margin
Fixes: #3722 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'themes')
-rw-r--r--themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/json-menu.htm15
1 files changed, 15 insertions, 0 deletions
diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/json-menu.htm b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/json-menu.htm
index 9d58ba2dba..ea11cf2263 100644
--- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/json-menu.htm
+++ b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/json-menu.htm
@@ -98,6 +98,13 @@
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) {
var tree = <%= luci.http.write_json(luci.dispatcher.menu_json() or {}) %>,
node = tree,
@@ -114,6 +121,14 @@
if (node)
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>