Akryum / vue-virtual-scroller

⚡️ Blazing fast scrolling for any amount of data
https://vue-virtual-scroller-demo.netlify.app
9.62k stars 911 forks source link

How to detect bottom scroll? #269

Open kgrosvenor opened 5 years ago

Christilut commented 4 years ago

You can do something like this:

  onScrollerMouse(e: WheelEvent) {
    const scrollerEl: Element = (this.$refs as any).scroller.$el as Element

    if (scrollerEl) {
      if (e.deltaY < 0) {
        if (scrollerEl.scrollTop === 0) {
          // reached top
        }
      } else if (e.deltaY > 0) {
        if (scrollerEl.scrollTop + scrollerEl.getBoundingClientRect().height >= scrollerEl.scrollHeight - 300) {
          // reached bottom within 300px
        }
      }
    }
  }