Update jquery zoom to grab alt from source image

This commit is contained in:
Jonathan Sadowski 2020-07-01 12:12:12 -05:00
parent c9e327809a
commit c0fe1e25de
1 changed files with 2 additions and 1 deletions

View File

@ -100,6 +100,7 @@
var srcElement = source.querySelector('img'); var srcElement = source.querySelector('img');
if (srcElement) { if (srcElement) {
settings.url = srcElement.getAttribute('data-src') || srcElement.currentSrc || srcElement.src; settings.url = srcElement.getAttribute('data-src') || srcElement.currentSrc || srcElement.src;
settings.alt = srcElement.getAttribute('data-alt') || srcElement.alt;
} }
if (!settings.url) { if (!settings.url) {
return; return;
@ -227,7 +228,7 @@
}; };
img.setAttribute('role', 'presentation'); img.setAttribute('role', 'presentation');
img.alt = ''; img.alt = settings.alt || '';
img.src = settings.url; img.src = settings.url;
}); });
}; };