Reputation: 31
var loadUrl = "winners.php";
var ajax_load = '<div class="preloaders"><img src="img/preloader.gif" alt="Loadig..."></div>';
$(".page").click(function(){
$(".main").html(ajax_load).load(loadUrl);
});
I want to display my .gif animation in a web page, but it doesn't work in Google Chrome. With Firefox there is no problem. The idea is on a click to load the content and if it takes time to show the preloader.
Upvotes: 2
Views: 929
Reputation: 27305
I think the problem is that you output the preloading image with javascript. Then you see the image first when the site is loaded.
A better way is to output the image direktly on your site over HTML without javascript.
<div id="preloaders" style="display: block;"><img src="img/preloader.gif" alt="Loadig..."></div>
If javascript is loaded and all your content is ready hide the div.
$('#preloaders').hide();
Upvotes: 1