Skip to content

Commit

Permalink
#86 - Retina bugfix: do not preload retina images on 1x screen devices
Browse files Browse the repository at this point in the history
  • Loading branch information
viliusle committed Oct 23, 2021
1 parent 6f89e97 commit 264530e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/types/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ImageType {
IMAGE.setAttribute('data-src', el.href)

if (el.hasAttribute('data-srcset')) {
IMAGE.setAttribute('srcset', el.getAttribute('data-srcset'))
IMAGE.setAttribute('data-srcset', el.getAttribute('data-srcset'))
}

// Add image to figure
Expand Down Expand Up @@ -95,6 +95,10 @@ class ImageType {

IMAGE.setAttribute('src', IMAGE.getAttribute('data-src'))
IMAGE.removeAttribute('data-src')

if (IMAGE.hasAttribute('data-srcset')) {
IMAGE.setAttribute('srcset', IMAGE.getAttribute('data-srcset'))
}
}

onLeave (container) {
Expand Down

0 comments on commit 264530e

Please sign in to comment.