// Store scroll position when user scrolls
window.addEventListener('scroll', function() {
localStorage.setItem('scrollPosition', window.scrollY);
});
// Retrieve and scroll to stored position when user returns to the page
document.addEventListener('DOMContentLoaded', function() {
const scrollPosition = localStorage.getItem('scrollPosition');
if (scrollPosition) {
setTimeout(function() {
window.scrollTo(0, scrollPosition);
localStorage.removeItem('scrollPosition'); // Clear the stored position after scrolling
}, 100); // Delay scrolling by 100ms to ensure page elements are fully loaded
}
});