Skip to content

Commit 8f5c8ff

Browse files
authored
Merge pull request #9 from yehiarasheed/fix-section-states
[fix] Added feature to keeping Section States.
2 parents 7b084ea + 2beb4ec commit 8f5c8ff

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)