-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transform "beforeUnveil" and "beforeSizes" callbacks to event #3
Comments
I would at least add a lazysizes reference to the events, Nice work |
@rolfnl |
ping: @julien-f and @mikestecker Due to the fact that this is a great, but non backwards compatible API change (i.e.: I have removed the simple |
Thank you, it looks great! I don't have time to play with it for now (overloaded by work for a few weeks) but I'll keep an eye on it. |
Currently any system can hook into the "get in view logic" and extend changing the
sizes
or "unveiling" elements through thebeforeUnveil
orbeforeSizes
callback for something like a background or a video poster it could look something like this:For seperation of concerns it would be a lot better to handle does extendable cases through events. The
beforeUnveil
option could be calledbeforeunveil
,lazyinview
or ?. ThebeforeSizes
callback could be calledbeforesizes
,lazyautosizes
or ?. Any suggestions are appreciated!!!Using this system could be used with and without event delegation:
Here an example using event delegation for the backgroundImage transition and for the video[data-poster] transition:
This way lazySizes handles still the most important usecases (image, iframes) and is lightweight, but makes sure that other usecases can be implemented much easier.
Note: backgroundimages and video posters are not scanned by the preload parser. Therefore they delay the onload event, but aren't often delaying other resources (because thier download priority is already often lower, that from other resources).
see also: #2 and #1
The text was updated successfully, but these errors were encountered: