Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Lazy Loading Images w/ jQuery
<div class="lazyImage" data-src="" data-width="200" data-height="200" data-title="Mmmm Bacon"></div>
$(function() {
var b, e;
b = $(window);
e = $('.lazyImage');
b.scroll(function() {
$.each(e, function() {
var c = $(this), a, d;
a = c.offset();
d =;
if(!d.loaded && <= b.height() + b.scrollTop()) {
a = new Image, $.extend(a, d), a.onload = function() {
e = $('.lazyImage')
},'loaded', !0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.