// Get the header element
const header = document.querySelector('.headerv2');
// Get the initial offset of the header
const headerOffsetTop = header.offsetTop;
// Add an event listener to the window object to listen for scrolling
window.addEventListener('scroll', () => {
// Get the current scroll position
const scrollPosition = window.scrollY;
// Check if the scroll position is greater than or equal to the header's initial offset
if (scrollPosition >= headerOffsetTop) {
// Add the "sticky" class to the header
header.classList.add('sticky');
} else {
// Remove the "sticky" class from the header
header.classList.remove('sticky');
}
});