Run the function you set when the page scrolls to bottom.
yarn add bottom-trigger
import { bottomTrigger } from 'bottom-trigger'
const someButton = document.getElementById('some-button')
bottomTrigger(
  window,
  () => {
    // called when the scroll arrives to the bottom
    someButton.removeAttribute('disabled')
  },
  () => {
    // called when the scroll leaves from the bottom
    someButton.setAttribute('disabled', true)
  },
  {
    offset: 32
  }
)You need to pass the Window, Document, or HTMLElement as a target area to the first argument.
You can pass the callback which will be called when the scroll goes to the bottom of the area.
You can pass the callback which will be called when the scroll leaves the bottom of the area.
You can specify the offset from the bottom of the page as offset of 4th arg.
Now there is offset only on options.