File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 15
15
var sidebar = document.getElementById("sidebar");
16
16
if (sidebar) {
17
17
// Restore scroll position
18
- var scrollPosition = localStorage .getItem("sidebarScrollPosition");
18
+ var scrollPosition = sessionStorage .getItem("sidebarScrollPosition");
19
19
if (scrollPosition) {
20
20
sidebar.scrollTop = scrollPosition;
21
21
}
22
22
23
23
// Save scroll position
24
- sidebar.addEventListener("scroll", function() {
25
- localStorage .setItem("sidebarScrollPosition", sidebar.scrollTop);
24
+ sidebar.addEventListener("scroll", function () {
25
+ sessionStorage .setItem("sidebarScrollPosition", sidebar.scrollTop);
26
26
});
27
27
}
28
28
});
29
+
30
+ // Function to clear scroll position
31
+ function clearScrollPosition() {
32
+ sessionStorage.removeItem("sidebarScrollPosition");
33
+ }
29
34
</script>
30
35
</head>
31
36
<body>
39
44
<div>
40
45
<asp:ContentPlaceHolder ID="Header" runat="server" />
41
46
</div>
42
- <a href="/Pages/Login/Login.aspx" class="back-button">Logout</a>
47
+ <a href="/Pages/Login/Login.aspx" onclick="clearScrollPosition();" class="back-button">Logout</a>
43
48
</div>
44
49
<div class="content">
45
50
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
You can’t perform that action at this time.
0 commit comments