Why is dispatchEvent broken?

  • 0
    Well the point is this.
    const event = new WheelEvent('docscroll')
    anotherElement.addEventListener('docscroll', function() {/* функция */})

    I want other elements to know when the document is scrolling, but for some reason the document doesn't emit an event.
    JavaScript Adalyn Murray, Oct 17, 2020

  • 1 Answers
  • 0
    You fire an event at the topmost level (document). Naturally, the elements below it will not see it.

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!