luis-almeida / unveil

A very lightweight jQuery plugin to lazy load images
4.16k stars 676 forks source link

Add support for watching elements other than window #131

Open j0xhn opened 7 years ago

j0xhn commented 7 years ago

So, I loved how small this code is, but needed just a little bit more functionality of detecting other elements that are off to the SIDE of the screen, not just below the fold. Also allows to watch scrolling of a parent or other element (incase images are nested) incase the images are in a modal or side-drawer (that was my use case) and you've frozen the body to not allow any scrolling. This will allow for that. Didn't know if you guys have purposely left it out, but I thought I'd share with you incase you wanted to add it to your code. Doesn't add much complexity, but does increase usability :)