BragDeal
BragDeal

Reputation: 748

jquery show loading image until page loaded in div

I am trying to show a loading image every time the page loads into the div but I don't see the loading image.

I tried this:

<img src="images/ajax-loader.gif" id="loading">

Jquery:

$('#content').fadeOut('fast', function(){
    $('#loading').show();
    $('#content').load("about.php", function(){
        $('#content').fadeIn('slow');
        $('#loading').hide();
    });
});

Upvotes: 1

Views: 728

Answers (2)

Simon Barendse
Simon Barendse

Reputation: 97

You have a missing quotation-mark in your jQuery, after about.php.

This is the revised jQuery:

$('#content').fadeOut('fast', function(){
    $('#loading').show();
    $('#content').load("about.php", function(){
         $('#content').fadeIn('slow');
         $('#loading').hide();
    });
});

Upvotes: 0

Crunch Much
Crunch Much

Reputation: 1527

Keep your <img src="images/ajax-loader.gif" id="loading"> outside of #content div.

Upvotes: 2

Related Questions