Set background color on blurhash image load

This commit is contained in:
Bill Thornton
2020-08-19 13:02:09 -04:00
parent 808a670b55
commit 5e1d4edd87
+2
View File
@@ -87,6 +87,7 @@ import 'css!./style';
requestAnimationFrame(() => {
if (elem.tagName !== 'IMG') {
elem.style.backgroundImage = "url('" + url + "')";
elem.style.backgroundColor = '#fff';
} else {
elem.setAttribute('src', url);
}
@@ -108,6 +109,7 @@ import 'css!./style';
if (elem.tagName !== 'IMG') {
url = elem.style.backgroundImage.slice(4, -1).replace(/"/g, '');
elem.style.backgroundImage = 'none';
elem.style.backgroundColor = null;
} else {
url = elem.getAttribute('src');
elem.setAttribute('src', '');