Skip to content

Commit 027c173

Browse files
committed
Added the Feature of keeping the state of the sidebar in the Admin Portal even whenever the Content Section is changed.
1 parent 5c33e1c commit 027c173

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

WebApplication2/Site.Master

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,26 @@
77
<meta charset="UTF-8">
88
<title><asp:ContentPlaceHolder ID="title" runat="server" /></title>
99
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&family=Roboto:wght@700&display=swap" rel="stylesheet"> <!-- Added Roboto for Logo -->
10-
<link rel="stylesheet"
11-
href="https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css">
12-
<link rel="stylesheet"
13-
href="https://unpkg.com/boxicons@latest/css/boxicons.min.css">
14-
10+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css">
11+
<link rel="stylesheet" href="https://unpkg.com/boxicons@latest/css/boxicons.min.css">
1512
<link rel="stylesheet" type="text/css" href="~/Styles/site.css" />
13+
<script>
14+
document.addEventListener("DOMContentLoaded", function() {
15+
var sidebar = document.getElementById("sidebar");
16+
if (sidebar) {
17+
// Restore scroll position
18+
var scrollPosition = localStorage.getItem("sidebarScrollPosition");
19+
if (scrollPosition) {
20+
sidebar.scrollTop = scrollPosition;
21+
}
22+
23+
// Save scroll position
24+
sidebar.addEventListener("scroll", function() {
25+
localStorage.setItem("sidebarScrollPosition", sidebar.scrollTop);
26+
});
27+
}
28+
});
29+
</script>
1630
</head>
1731
<body>
1832
<form id="form1" runat="server">
@@ -23,16 +37,15 @@
2337
<div id="contentArea">
2438
<div class="headerContainer">
2539
<div>
26-
<asp:ContentPlaceHolder ID="Header" runat="server" />
27-
40+
<asp:ContentPlaceHolder ID="Header" runat="server" />
2841
</div>
2942
<a href="/Pages/Login/Login.aspx" class="back-button">Logout</a>
30-
</div>
31-
<div class="content">
32-
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
33-
</div>
43+
</div>
44+
<div class="content">
45+
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
46+
</div>
3447
</div>
3548
</div>
3649
</form>
3750
</body>
38-
</html>
51+
</html>

0 commit comments

Comments
 (0)