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 6829547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:30:47+00:00 2026-05-26T22:30:47+00:00

So I just started learning Javascript and jQuery at the same time, and it

  • 0

So I just started learning Javascript and jQuery at the same time, and it seems easy.

Now I am making a function that shows a loading image (I made mine on http://www.ajaxload.info/) but I want something that’s more cool, like maybe an image that changes every time…

Also, sometimes my loading image appears under other stuff I have no clue why so I am trying to fix that problem, if you have any hints please let me know.

Here is what I have now:

...
<img id="loading" src="loading.gif" />
...
<script>
function load(){
 $("#loading").fadeToggle();
}
</script>
  • 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-05-26T22:30:48+00:00Added an answer on May 26, 2026 at 10:30 pm

    I have done this with my projects, very interesting idea! So here’s how i do it.

    Of course you can tweak this as you wish and i am sure there are lots of stuff you can do to make it more beautiful but here is what you can do with minimal configuration.

    CSS :

    .preloader{
        z-index: 1001;  // This is what controls the layer position (the more it's high the more it becomes on top) I put 1001 because i don't use z-indexes more than 1000 but idk about you..
    }
    

    HTML :

    <div class="preloader">
        <img src="images/preloaders/1.png" /> <!-- You can add restriction to the size of the preloader image, you can also apply styling to the div so that it covers the whole page (making a 'modal' effect) -->
    </div>
    

    Javascript (jQuery) :

    <script>
    var MAX_PRELOADERS = 5; // How many different preloaders do you have ? (Make sure they are named appropriately : 1.png , 2.png ... 5.png (and in the right folder)
    
    function showHidePreloader(){ // Basically just the same as yours
        $(".preloader img").fadeToggle();
    }
    
    function changePreloader(){
        var new_preloader = Math.round(Math.random() * MAX_PRELOADERS) + 1; // This will generate a number between 1 and MAX_PRELOADERS
        $(".preloader img").attr("src","images/preloaders/"+new_preloader+".png"); // Make sure to correct the path and extension if they're different
    }
    </script>
    

    BTW, for preloaders i use this site : http://preloaders.net/
    I am sure you will like it! It’s far better than the one you have.
    So basically just call the changePreloader() when you want to change it, and well for the first function you know how to use it already 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, I've just started learning JavaScript and I'm making a little script that generates
I have just started learning Jquery and am new to writing javascript (I am
I've just started learning jQuery/javascript, so this might seem like a really basic question,
I just recently started learning RoR and found that Prototype.js is a default javascript
I've just started learning javascript and have created a drag and drop using jquery
I have just started writing my own JavaScript Framework (just for the learning experience),
I have just started learning Javascript. I want Hello World! to be written to
I have just started learning Javascript and I am absolutely overwhelmed with the number
I just started learning C++ couple of weeks ago. So now I have this
I just started learning javascript for 2 weeks so I'm pretty new to it.

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.