1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update detail images

This commit is contained in:
Luke Pulverenti 2015-06-28 11:43:49 -04:00
parent 95a647e0df
commit a0b6f768b3
14 changed files with 112 additions and 73 deletions

View file

@ -97,12 +97,11 @@
var threshold = getThreshold();
function isVisible() {
return visibleInViewport(this, true, false, 'both', threshold);
function isVisible(elem) {
return visibleInViewport(elem, true, false, 'both', threshold);
}
function fillImage() {
var elem = this;
function fillImage(elem) {
var source = elem.getAttribute('data-src');
if (source) {
ImageStore.setImageInto(elem, source);
@ -116,19 +115,25 @@
return;
}
var images = $(elems),
loaded;
var images = elems;
unveilId++;
var eventNamespace = 'unveil' + unveilId;
images.one("unveil", fillImage);
function unveil() {
var inview = images.filter(isVisible);
loaded = inview.trigger("unveil");
images = images.not(loaded);
var remaining = [];
for (var i = 0, length = images.length; i < length; i++) {
var img = images[i];
if (isVisible(img)) {
fillImage(img);
} else {
remaining.push(img);
}
}
images = remaining;
if (!images.length) {
Events.off(window, 'scroll.' + eventNamespace);