Blazor Server Collapsible Nav Menu with Sub Menus and JS fix positioning when page width is altered.

This commit is contained in:
2024-07-03 18:03:35 +01:00
parent 9830a2d849
commit 444306c2d0
4 changed files with 230 additions and 80 deletions

View File

@@ -8,12 +8,24 @@
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="Blazor_Server.styles.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">
<link rel="icon" type="image/png" href="favicon.png" />
<HeadOutlet @rendermode="InteractiveServer" />
</head>
<body>
<Routes @rendermode="InteractiveServer" />
<script>
window.setResizeCallback = (dotNetHelper) => {
const resizeCallback = () => {
const isBelowThreshold = window.innerWidth < 642;
dotNetHelper.invokeMethodAsync('OnResize', isBelowThreshold);
};
window.addEventListener('resize', resizeCallback);
resizeCallback();
};
</script>
<script src="_framework/blazor.web.js"></script>
</body>