Created
June 5, 2018 10:01
-
-
Save solid-pixel/64c6d4b9dfb6f4e17e2045f9c1fa76e3 to your computer and use it in GitHub Desktop.
jQuery ajax .load() - callback waits for images to load
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
$('#newsletter').load('content.html', function() { | |
var images = $('#newsletter img'); | |
var nimages = images.length; | |
images.load(function() { | |
nimages--; | |
if(nimages == 0) { | |
// images loaded. now execute Callback: | |
alert('all images loaded!'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment