Preloader image does not unload when using the Rocket Loader

My site Traken.net has a simple preloader image that is removed when the page is fully loaded.

This works fine until I enable the Rocket Loader. When I do, the code that removes the preloader never runs:

    $(window).on("load", function () {
			console.log("removing loader");
			$('.preloader').fadeOut(500, function () { $('.preloader').remove(); });
		
	});

    <script  data-cfasync="false" type="text/javascript" src="js/main.js"></script>

I added the data-cfasync to the script, but it still does not run.

Is there a way to resolve this?

I checked your homepage and couldn’t see this code, so I’m working in the dark a bit here. You would need to ensure you add the data-cfasync="false" attribute to the inline JS you quoted also. Are you doing that?

This topic was automatically closed after 14 days. New replies are no longer allowed.