
function scrollFunction(homeSection, scrollTopBtn) {
    if (window.pageYOffset > 200) {
      scrollTopBtn.style.display = "block";
    } else {
      scrollTopBtn.style.display = "none";
    }
  }
  
  function scrollToTop(scrollTopBtn, homeSection) {
    scrollTopBtn.style.display = "none"; 
    window.scrollTo({
      top: 0,
      behavior: 'smooth' 
    });
  }
  
  function initScroll(homeSectionId, scrollTopBtnId) {
    const homeSection = document.getElementById(homeSectionId); 
    const scrollTopBtn = document.getElementById(scrollTopBtnId); 
  
    window.addEventListener('scroll', () => scrollFunction(homeSection, scrollTopBtn)); 
    scrollTopBtn.addEventListener('click', () => scrollToTop(scrollTopBtn, homeSection));
  }
  
  module.exports = {
    scrollFunction,
    scrollToTop,
    initScroll
  };
  