2

I'm using Mika Tuupola's jQuery Lazy Loading.

Is it possible to call a function, every time after an image is lazy loaded.

What I'm intending to do is to track the number of times an image was viewed. So, if the image was lazy loaded, it means the user had seen the image and I'll increment a counter on my database by 1 by doing a HTTP GET on the background.

1 Answer 1

3

Looking at the source, I found two undocumented callback options: appear is called before loading an image, load is called after the image is loaded. The parameters are the image element, the number of unloaded images, and the options object.

Sign up to request clarification or add additional context in comments.

1 Comment

It wasn't obvious that this is what those options do! I was very close to recommending that you write an onload handler that checked whether the src was the placeholder image or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.