luis-almeida / unveil

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

option to use requestAnimationFrame #99

Open grma1 opened 9 years ago

grma1 commented 9 years ago

As the callback functionality was removed in v2 branch I've added it back as it could be handy from time to time.

I've also added an option to use requestAnimationFrame instead of setTimeout to avoid unnecessary reflows.

The filter loop was also optimized a bit to avoid reflows due to .scrollTop() and .offset() calls.