document.addEventListener('DOMContentLoaded', function() {
    let lastScrollTop = 0;
    window.addEventListener('wheel', function(event) {
        let currentScrollTop = window.pageYOffset || document.documentElement.scrollTop;
        if (event.deltaY > 0 && currentScrollTop % window.innerHeight === 0) {
            // Scroll nach unten
            window.scrollBy({ top: window.innerHeight, behavior: 'smooth' });
        } else if (event.deltaY < 0 && lastScrollTop === currentScrollTop) {
            // Scroll nach oben
            window.scrollBy({ top: -window.innerHeight, behavior: 'smooth' });
        }
        lastScrollTop = currentScrollTop <= 0 ? 0 : currentScrollTop; 
        event.preventDefault();
    }, { passive: false });
});

$('body').on('keydown', function(e) {
  e.preventDefault();
  
  if(e.which === 40 && currentSection < sections.length - 1) { // Pfeil nach unten
    currentSection++;
  } else if(e.which === 38 && currentSection > 0) { // Pfeil nach oben
    currentSection--;
  }
  
  window.scrollTo({
    top: sections.eq(currentSection).offset().top,
    behavior: 'smooth'
  });
});

let currentSection = 0;
const sections = $('.section'); // Ersetzen Sie .section durch die Klasse Ihrer Sektionen.

$('body').on('wheel', function(e) {
  e.preventDefault();
  
  if (e.originalEvent.deltaY > 0 && currentSection < sections.length - 1) {
    currentSection++;
  } else if (e.originalEvent.deltaY < 0 && currentSection > 0) {
    currentSection--;
  }
  
  window.scrollTo({
    top: sections.eq(currentSection).offset().top,
    behavior: 'smooth'
  });
});