Skip to content

Commit e0617d0

Browse files
Fixed Side Bar
1 parent 1bf95b9 commit e0617d0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
@namespace Blazor.AdminLte
2+
@inject IJSRuntime JS
23
<div class="sidebar">
34
@ChildContent
45
</div>
56
@code {
67
[Parameter]
78
public RenderFragment ChildContent { get; set; }
9+
10+
private bool _isFixed;
11+
12+
[Parameter]
13+
public bool IsFixed
14+
{
15+
get
16+
{
17+
return _isFixed;
18+
}
19+
set
20+
{
21+
_isFixed = value;
22+
JS.InvokeVoidAsync("sideBarFixed", _isFixed);
23+
}
24+
}
825
}

src/Blazor.AdminLte/wwwroot/js/interop.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,12 @@ function dateRangePicker(dotnetRef, el, range, locale, settings) {
5454

5555
function setTitle(title) {
5656
document.title = title;
57+
}
58+
59+
function sideBarFixed(isFixed)
60+
{
61+
if (isFixed)
62+
$("body").addClass("layout-fixed");
63+
else
64+
$("body").removeClass("layout-fixed");
5765
}

0 commit comments

Comments
 (0)