var timerId;

window.addEventListener('scroll', function (e) {
    var currentHeight = window.scrollY;
    var positionMore = parseInt($('#more-photo').position().top) - parseInt($(window).height());

    if (positionMore - 150 <= currentHeight) {
        clearTimeout(timerId);
        timerId = setTimeout(function () {
            loadMorePhoto();
        }, 100);
    }
});