Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7771175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:35:07+00:00 2026-06-01T16:35:07+00:00

I have an animated gif that’s supposed to run until a page completes loading.

  • 0

I have an animated gif that’s supposed to run until a page completes loading. The gif is being handled in the stylesheet, and I want a bit of javascript to change the background element when the page loads to hide the gif. Here’s the code:

<script language="Javascript" type="text/javascript">
    $('#confirm .checkout-heading').css("background", "#fff url('../image/ajax-loader.gif') 98% 50% no-repeat");
    $.ajax({
    url: 'checkout/checkout.php',
    success: function(data) {},
    failure: function(){},
    complete: function(){ $('#confirm .checkout-heading').css("background", "#fff"); }
    });
</script>

style:

#confirm .checkout-heading {
    background: #fff url('../image/ajax-loader.gif') 98% 50% no-repeat;

I’ve tried debugging, and I’ve determined that it’s stuck on the complete: function(), but I’m not js savvy enough to know how to fix this. Thanks for any help…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:35:09+00:00Added an answer on June 1, 2026 at 4:35 pm

    Your javascript code seems fine, although makes it hard to maintain your code and styles, because you’re mixing both… Anyway. Your Syntax error must be pointing somewhere else, because based on your code, nothing should be wrong with it.

    I suggest you do it this way

    This will make it much easier to maintain your code, because styles will be completely separate from code. Your code will merely manipulate CSS classes.

    Have two CSS definitions related to this:

    #confirm .checkout-heading {
        background-color: #fff;
    }
    
    #confirm .checkout-heading.loading
        background-image: url('../image/ajax-loader.gif');
        background-position: 98% 50%;
        background-repeat: no-repeat;
    }
    

    And then write your Javascript code as:

    var el = $("#confirm .checkout-heading").addClass("loading");
    $.ajax({
        url: 'checkout/checkout.php',
        success: function(data) {},
        failure: function() {},
        complete: function() {
            el.removeClass("loading");
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loader animated gif that I want to hide and show during
I have an animated gif file that I want to use in my iPhone
If I have an animated gif that just runs a single animation, IE. it
I have an animated .GIF image that I created with http://ajaxload.info/ and some editing.
I have a situation where I want to return an animated gif from an
I have an animated GIF that plays once (doesn't loop). I would like it
I have an animated gif placed on the button. It's animating ok (most of
I have imported an animated GIF as a resource into a picturebox - unfortunitly
I have a .NET WinForms application with an animated GIF in a PictureBox .
Is there a way to have an animated loading screen for my iPhone application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.