Skip to content

Commit 2beb4ec

Browse files
committed
[fix] Added feature to keep track of the Currently Opened Section and prevent it from changing unless the Customer willingly changes the section.
1 parent 7b084ea commit 2beb4ec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

WebApplication2/Customer/Pages/CustomerComponent.aspx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,12 @@
600600
function showSection(id) {
601601
document.querySelectorAll('.content').forEach(el => el.style.display = 'none');
602602
document.getElementById(id).style.display = 'block';
603+
604+
// Save the current section to localStorage
605+
localStorage.setItem('activeSection', id);
603606
}
604607
605-
// Dark Mode Toggle
608+
606609
// Dark Mode Toggle
607610
function toggleDarkMode() {
608611
const body = document.body;
@@ -662,7 +665,10 @@
662665
});
663666
});
664667
665-
window.onload = () => showSection('servicePlans');
668+
document.addEventListener("DOMContentLoaded", function () {
669+
const activeSection = localStorage.getItem('activeSection') || 'servicePlans';
670+
showSection(activeSection);
671+
});
666672
</script>
667673
</body>
668674
</html>

0 commit comments

Comments
 (0)