X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/626c374dc3f412d481ebc56386ab7f6bdd05b5e9..536b189c1a7173b2ea5f5ba16387ec904a7ce40e:/project/static/js/jquery.lazyload.js diff --git a/project/static/js/jquery.lazyload.js b/project/static/js/jquery.lazyload.js old mode 100644 new mode 100755 index ea3de6ff..c15167bd --- a/project/static/js/jquery.lazyload.js +++ b/project/static/js/jquery.lazyload.js @@ -12,7 +12,7 @@ } var container = this; - container.data('lastScroll', -10000); + container.data('lazyload:lastCheckedScrollTop', -10000); function aboveViewport(container, element, threshold) { return $(container).offset().top >= $(element).offset().top + $(element).height() + threshold; @@ -23,8 +23,11 @@ } function checkScroll() { - if (Math.abs(container.scrollTop() - container.data('lastScroll')) > settings.scrollThreshold) { - container.data('lastScroll', container.scrollTop()); + if (container.data('lazyload:lastCheckedScrollTop') == undefined) { + return; + } + if (Math.abs(container.scrollTop() - container.data('lazyload:lastCheckedScrollTop')) > settings.scrollThreshold) { + container.data('lazyload:lastCheckedScrollTop', container.scrollTop()); $(pattern, container).each(function() { if (aboveViewport(container, this, settings.threshold)