Closed willian12345 closed 9 years ago
Thanks for the PR.
I am sorry it's undocumented but already exists.
What you want to do is almost already feasible like this:
lazyload(ADOMElement, function onVisible() {
// will be called when ADOMelement becomes visible
// src will not be changed for you
});
You can also use vvo/in-viewport because this example is just an alias of in-viewport.
Do you think that's sufficient or do you really need this functionnality?
I think you could just use the standard lazyload and then if in the need for a callback on every element you can lazyload(ADOMElement, function onVisible() {});
If you really need this functionnality as the code is very small, we can integrate it, bust you need to add a test.
The test paragraph of the readme is pretty self explanatory and will be a good start.
Thanks.
Hi, Thanks for replied. I have read the lazyload.js and in-viewport.js Actually, I use the lazyload like your said in the beginning
lazyload(ADOMElement, function onVisible() {
// will be called when ADOMelement becomes visible
// src will not be changed for you
});
But i have to write the lazyload' logic in the in-viewport's callback And we often add some animations to the lazyload dom even we use any other lazyloader
Now i used your lazyload in my project In this page http://crapi.4gshu.com:8096/rongshuxia/excellent.html
The test, er.......
add onVisible callback callback will be called when the element in viewport
it's useful to extend functionally outside. like this example in my project, I can do anything i want on 'elem'