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

  • Home
  • SEARCH
  • 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 6245703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:33:11+00:00 2026-05-24T12:33:11+00:00

preload = function() { var imgList = []; var imgArr = []; var imageSize

  • 0
preload = function() {

        var imgList = [];
        var imgArr = [];
        var imageSize = element.find('img').size();
        var loadImgList = element.find('img');
        for(i=0; i<imageSize;i++){
            imgArr.push($(loadImgList[i]).attr('src'));
        }

        var total = imgArr.length;
        var loaded = 0;

        for(var i in imgArr) {
            imgList.push($("<img />")
                .attr("src", imgArr[i])
                .load(function() {
                    loaded++;
                    if(loaded == total) {
                        element.find('.loader').fadeOut('slow');
                        init();
                    }
                })
            );
        }

    }
  • 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-24T12:33:12+00:00Added an answer on May 24, 2026 at 12:33 pm

    I don’t know whether this solves your problem since you’re not saying what exactly doesn’t work, but you need to set src after you define the handler for the onload event.

    Also, note that .load() has numerous issues when used with images as outlined in the jQuery docs:

    Caveats of the load event when used with images

    A common challenge developers attempt to solve using the .load()
    shortcut is to execute a function when an image (or collection of
    images) have completely loaded. There are several known caveats with
    this that should be noted. These are:

    • It doesn’t work consistently nor reliably cross-browser
    • It doesn’t fire correctly in WebKit if the image src is set to the
      same src as before
    • It doesn’t correctly bubble up the DOM tree
    • Can cease to fire for images that already live in the browser’s
      cache
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this, which preloads an image: $('<img />') .attr('src', 'source') .load(function(){ $('.profile').append( $(this) );
I have the code below: $(document).ready(function() { var bgimages=new Array() bgImages[0]=bg.jpg bgImages[1]=bg2.jpg //sloppy preload
I use the load function to preload Images before applying a hover effect. $(img).load(function(){
Hay guys, I'm making a simple preload function (function($) { $.fn.preload = function(settings) {
Here is my preload script: <script type=text/javascript> Image_1 = new Image(1,1); Image_1.src = images/sprites.png;
Is the function I wrote below enough to preload images in most, if not
I have the following simple preloading function which substitute an image src attribute with
I have this banner rotator code: function ban_rot() { //First preload images // counter
This slider works but I just need to preload images: document.observe(dom:loaded, function(event) { initSlider()
I'm using this code to preload all the images I need var cache =

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.