From 2a45b17ca825dc6700536388d6510516fda270cc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 13 Sep 2021 00:08:35 +0200 Subject: [PATCH] Bug 28180: Fix bug with first image does not exist This was first written for Adlibris, before its removal from the codebase. But this patch maybe still be useful for other services (if first and no image). --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 9b6ec9a27fa..00bd80863a8 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1392,19 +1392,21 @@ // Loop over each container in the template which contains covers $(".cover-slider").each(function( index ){ var lightbox_descriptions = []; + var first_shown = 0; $(this).find(".cover-image").each( function( index ){ var div = $(this); // Find the image in the container var img = div.find("img")[0]; if( img && $(img).length > 0 ){ var description = ""; - if( (( img.complete != null && !img.complete) || img.naturalHeight == 0 ) && div.attr("id") != "googlejacket-coverimg" ){ + if( img.naturalHeight == 0 && div.attr("id") != "googlejacket-coverimg" ){ // No image loaded in the container. Remove the slide div.remove(); } else { // All slides start hidden. If this is the first one, show it. - if( index == 0 ){ + if( first_shown == 0 ){ div.show(); + first_shown = 1; } // Check if Amazon image is present if ( div.attr("id") == "amazon-bookcoverimg" ) { -- 2.25.1