mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Enabled lazy load of poster images
This should make initial load of the movies page a little more responsive for larger libraries. This can be used on any page loading images.
This commit is contained in:
parent
66f8b0f93d
commit
2365becc14
4 changed files with 88 additions and 3 deletions
|
@ -433,6 +433,8 @@
|
|||
|
||||
options.shape = options.shape || "portrait";
|
||||
|
||||
options.lazy = options.lazy || false;
|
||||
|
||||
var html = "";
|
||||
|
||||
var primaryImageAspectRatio = options.shape == 'auto' ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
||||
|
@ -668,7 +670,7 @@
|
|||
|
||||
var style = "";
|
||||
|
||||
if (imgUrl) {
|
||||
if (imgUrl && !options.lazy) {
|
||||
style += 'background-image:url(\'' + imgUrl + '\');';
|
||||
}
|
||||
|
||||
|
@ -681,9 +683,16 @@
|
|||
imageCssClass += " coveredPosterItemImage";
|
||||
}
|
||||
|
||||
var dataSrc = "";
|
||||
|
||||
if (options.lazy) {
|
||||
imageCssClass += " lazy";
|
||||
dataSrc = ' data-src="' + imgUrl + '"';
|
||||
}
|
||||
|
||||
var progressHtml = options.showProgress === false ? '' : LibraryBrowser.getItemProgressBarHtml(item);
|
||||
|
||||
html += '<div class="' + imageCssClass + '" style="' + style + '">';
|
||||
html += '<div class="' + imageCssClass + '" style="' + style + '"' + dataSrc + '>';
|
||||
|
||||
html += '<div class="posterItemOverlayTarget"></div>';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue