$(window).scroll(function() {
    if (atBottomOfPage())
    {
        console.log('bottom here!')
    }
});

function atBottomOfPage()
{
    var distanceToViewportTop = (
        $(document).height() - $(window).height()
    );
    var viewPortTop = $(document).scrollTop();
    if (viewPortTop === 0) return false;
    return (viewPortTop - distanceToViewportTop === 0);
};