JavaScript cómo saber el final del pergamino

  if (myDiv.offsetHeight + myDiv.scrollTop >= myDiv.scrollHeight) {
    // Do something
  }
Lioruby