Loading js/resizer.js +5 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ const availableWidth = Math.floor(image.parentNode.clientWidth); const attrWidth = image.getAttribute('width'); const sources = image.getAttribute('data-srcset').split(','); const currentSrc = image.getAttribute('src'); // If the selected image is already bigger than the available width, // we do not update the image. Loading @@ -39,6 +40,10 @@ } } if (responsiveImgPath === currentSrc) { return; } // Update the "src" with the new image and also set the "width" // attribute to easily check if we need a new image after resize. image.setAttribute('src', responsiveImgPath); Loading Loading
js/resizer.js +5 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ const availableWidth = Math.floor(image.parentNode.clientWidth); const attrWidth = image.getAttribute('width'); const sources = image.getAttribute('data-srcset').split(','); const currentSrc = image.getAttribute('src'); // If the selected image is already bigger than the available width, // we do not update the image. Loading @@ -39,6 +40,10 @@ } } if (responsiveImgPath === currentSrc) { return; } // Update the "src" with the new image and also set the "width" // attribute to easily check if we need a new image after resize. image.setAttribute('src', responsiveImgPath); Loading