Hi all. I am trying to have an script fire ONLY after all images are loaded.
Here’s the page I have this running on. It’s the logo animation I’m trying to prevent from firing until after the images have loaded.
https://stable.stable-demos.com/blakes-seed-based/
When I add:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
// THIS ERRORS
$(window).load(function() {
alert("window load occurred!");
});
// THIS WORKS BUT LOADS BEFORE IMAGES ARE LOADED SO THE LOGO MESSES UP ON HEAVY IMAGE PAGES
jQuery(function($){
// SMOOTH OUT TRANSITION - STABLE LOGO
$('.qodef-page-header').waypoint(function(direction) {
// Target this element and run the up or down animation respectively
if (direction === 'down') {
$(".fadeMe").addClass("blur-in-fwd");
$(".fadeMe").removeClass("blur-in-bkw");
$("#smooth-logo").addClass("slideLeft");
$("#smooth-logo").removeClass("slideRight");
$("#animOut").get(0).beginElement(); // restart the animation
} else if (direction === 'up') {
$(".fadeMe").addClass("blur-in-bkw");
$(".fadeMe").removeClass("blur-in-fwd slide-right");
$("#smooth-logo").addClass("slideRight");
$("#smooth-logo").removeClass("slideLeft");
$("#animIn").get(0).beginElement(); // restart the animation
}
},
{ offset: "0%" })
});
<!-- end snippet -->
I get a console error.
Let me know if there’s anything else i can do to help get this figured out!
You can see the animation working correctly here so you know what it does without the console error. This is the logo I want to stop from running until the entire page is loaded.
http://gne.95f.myftpupload.com/blakes-seed-based/ (scroll down to enable the animation)
Thank you in advance!