Reputation: 7672
How do I delay the jQuery animation on my page until all CSS images are loaded?
Upvotes: 1
Views: 276
Reputation: 630627
Use the window.onload
event instead of document.ready
via .load()
, like this:
$(window).load(function() {
//animate things
});
The main difference here is that images are loaded, where they may or may not be on ready
, since it's looking to see that the DOM is loaded, not necessarily extra content in it, like images.
Upvotes: 4
Reputation: 236192
use the onload
event.
$(window).bind('load', function() {
// do the animation
});
Upvotes: 2