Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mikekavouras/858c195c09f5814c28953b9ad5689310 to your computer and use it in GitHub Desktop.
Save mikekavouras/858c195c09f5814c28953b9ad5689310 to your computer and use it in GitHub Desktop.
function loadImages(images, callback) {
var loaded = 0;
for (var i = 0; i < images.length; i++) {
var img = new Image();
img.onload = function() {
loaded++;
if (loaded === images.length) { callback(); }
};
img.onerror = img.onload;
img.src = images[i];
}
}
jQuery(document).ready(function() {
var $images = jQuery('.col-photo').find('p').first().children()
var images = $images.map(function(image, elem) { return jQuery(elem).attr('src'); });
loadImages(images, function() {
jQuery(".col-photo").stick_in_parent();
jQuery('.col-text').stick_in_parent();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment