Created
April 18, 2016 22:29
-
-
Save mikekavouras/858c195c09f5814c28953b9ad5689310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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