Releases: fhopeman/justlazy
Releases · fhopeman/justlazy
fix version
Fix Uncaught ReferenceError
Merge pull request #12 from fradav/master Removed hardcoded reference to "Justlazy"
Refactoring of replacement behavior
- replacement occurs not directly after the construction of the image, but within the
onload
oronerror
callback of the image itself. - The custom
onloadCallback
andonerrorCallback
will be invoked immediately before the replacement, so you can add some classes or do some other stuff. - The
onreplaceCallback
will be invoked after the actual replacement. - The advantage is, that the placeholder can hold the styling of the lazy image (e.g. the spinner) and is not deleted until the image is completely loaded.
Migration:
- Check your
onerrorCallback
: It's no longer for the missingdata-src
anddata-alt
attribute. With this callback you can define the action if the image could not be loaded properly. - The
data-onerror-handler
doesn't exist anymore. Please use theonerrorCallback
instead. - Check the styling and position of your spinner. The styling can be placed on the placeholder itself and will be removed after the image is loaded in the background.
replace image in case of invalid src attribute
The replacement of the placeholder should be performed in any case. If the image could not be loaded (e.g. image doesn't exist) the image onerror event handler should fix that.
Load visible images immediately
Visible images will be loaded directly without scrolling if they are visible
Use getBoundingClientRect to calc visibility
Use getBoundingClientRect().top to calculate the visibility of the placeholder. This fixes some problems if the placeholder is inside a wrapper (placeholder.offsiteTop doesn't work proper in some case).
add UMD wrapper
1.3.0 Update README.md
refactor npm
1.2.0 bump version to 1.2.0
npm integration
1.1.0 change keywords for npm
add auto lazy load
plugin can lazy load images which are visible in the viewport automatically now