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 :)
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 :)