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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:27:41+00:00 2026-05-26T21:27:41+00:00

I am looking for a way to load several hidden thumbnails on a page

  • 0

I am looking for a way to load several hidden thumbnails on a page (around 500), calculate their total widths, and show their container once they are all loaded.

The problem is that the container keeps showing before they all are loaded.

Here is the simplified snippet i extracted from my script:

// $('#thumbScroller') is the container, and is initially hidden.

var imgs = ['http://www.google.com/images/nav_logo95.png', 'http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=4'];

for(var i = 0; i < i.length; i++){
    var url = imgs[i];
    $('#thumbScroller').append('<img src="' + url + '" class="thumb" />');

    // all elements were appened at this point
    if(i == $this.totalImages-1 ){

        //variable to hold total container width
        var totalContent=0;

        // loop through images to calculate total width
        $('#thumbScroller img').each(function (s) {
            totalContent += $(this).width();

            //last image, show interface elements
            if(s == $('#thumbScroller img').length-1){
                $('#thumbScroller').width(totalContent).fadeIn();
            };

        });
    }

}

Any help would be appreciated!

  • 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-26T21:27:42+00:00Added an answer on May 26, 2026 at 9:27 pm
    for(var i = 0; i < imgs.length; i++){
        var url = imgs[i];
        $('#thumbScroller').append('<img src="' + url + '" class="thumb" />');
    }
    var imgCount = $('#thumbScroller img').length;
    var totalContent=0;
    $('#thumbScroller img').load(function() {
        if (!--imgCount) {
            $('#thumbScroller').width(totalContent);
            $('.loader').removeClass('visible');
            $('.interface').removeClass('hidden');
        } else {
            totalContent += $(this).width();
            console.log('continue...');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way to load a page (page A) (which I also
For performance purposes, I'm looking for a way to lazy load the fan page
I'm looking for a way to save and load several kinds of objects on
I'm looking for a way to load an XML file's contents directly into a
I'm looking for a way to load invalid (malformed) XML into an AS3 XML
I have been looking for a way to dynamically load functions into c++ for
I am looking for a way to have the background-images (CSS) load as if
I am looking to do something similar to the way CodeIgniter's load object works.
I'm looking for a way to load classes into PHP without using hardwired names.
Using System.AddIn, is there a way to load and activate an AddIn without locking

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.