Ahh I knew hardcoding that would be problematic somehow. Most of the known ways to detect the bottom of the page doesn't seem to work for me.
I had to use document.body.clientHeight to get viewport height cuz memo is not including a <!DOCTYPE html> at the top of the page, which prevents usual $(window).height() from working.