'Uncaught TypeError: Cannot read properties of undefined (reading 'querySelectorAll')at Number.handleHover

I have some JavaScrupt code that gives this error Uncaught TypeError: Cannot read properties of undefined (reading 'querySelectorAll')at Number.handleHover .

 const handleHover = function (e) {
      if (e.target.classList.contains('nav-link')) {
        const link = e.target;
        const sibling = link
          .closest('.nav-wrap')
          .document.querySelectorAll('.nav-link');
        sibling.forEach(el => {
          if (el !== link) el.style.opacity = this;
        });
      }
    };
navSmooth.addEventListener('mouseover', handleHover.bind(0.5));
navSmooth.addEventListener('mouseout', handleHover.bind(1));


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source