Skip to content
Snippets Groups Projects
Commit 6a78533d authored by Patrick Groeger's avatar Patrick Groeger
Browse files

Fixed applying 'cds-loading-error' to all thumbnail items instead of only the affected images

parent 70fa11aa
No related branches found
No related tags found
2 merge requests!13Increment production version to v2.3.0,!6Fix gallery thumbnail images
...@@ -64,10 +64,13 @@ ...@@ -64,10 +64,13 @@
.on('error', function () { .on('error', function () {
$(this).prev('span').removeClass('cds-background-hidden'); $(this).prev('span').removeClass('cds-background-hidden');
$(this).closest('figure').addClass('loading-cds-error'); $(this).closest('figure').addClass('loading-cds-error');
var errorurl = $(this).attr('src'); //gets the url which throws the error to find it afterwards in the thumbnail items
$(this).closest('.owl-carousel').find('.owl-thumb-item').each(function () { $(this).closest('.owl-carousel').find('.owl-thumb-item').each(function () {
var background = $(this).attr('style'); var background = $(this).attr('style');
if (background.indexOf("//cds.cern.ch/") >= 0) { if (background.indexOf(errorurl) >= 0) {
$(this).addClass('loading-cds-error'); $(this).addClass('loading-cds-error');
return false; //returning false to break out of the each() loop as the thumb item was found
} }
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment