How to track scroll up if pageYOffset = 0?

  • 0
    How to track scroll up if pageYOffset = 0? (mousewheel event, cannot be used: with)
    JavaScript Vivienne Wilson, Jan 20, 2019

  • 1 Answers
  • 0
    const getScroll() => {
    const doc = document.compatMode && document.compatMode.toLowerCase() === 'backcompat') ? document.body : document.documentElement
    return { 'x': window.pageXOffset || doc.scrollLeft, 'y': window.pageYOffset || doc.scrollTop };
    };


    Track, no event?
    Anonymous

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