function scrolled(e) { if (myDiv.offsetHeight + myDiv.scrollTop >= myDiv.scrollHeight) { scrolledToBottom(e); } }