X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/816a4653c0086eeaf57ba148864bb06678d9234c..34672fb6ded3a27e2b61959d7c5af184e3180ab9:/project/static/js/jquery.lazyload.js?ds=sidebyside
diff --git a/project/static/js/jquery.lazyload.js b/project/static/js/jquery.lazyload.js
index 25c94869..522250ff 100644
--- 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,15 +23,21 @@
}
function checkScroll() {
- if (Math.abs(container.scrollTop() - container.data('lastScroll')) > settings.scrollThreshold) {
- container.data('lastScroll', container.scrollTop());
+ 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)
|| belowViewport(container, this, settings.threshold)) {
$(this).html(settings.placeholder);
} else {
- $(this).html('');
+ $(this).html('');
+ var self = this;
+ $('').load(function() {
+ if ($(this).height() > $(self).height()) {
+ $(self).height($(this).height());
+ }
+ }).appendTo(this);
}
})
}