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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:48:54+00:00 2026-05-24T15:48:54+00:00

I have a very long page that dynamically loads images as users scroll through.

  • 0

I have a very long page that dynamically loads images as users scroll through.

However, if a user quickly scrolls away from a certain part of the page, I don’t want the images to continue loading in that now out-of-view part of the page.

There are lots of other requests happening on the page simultaneously apart from image loading, so a blunt window.stop() firing on the scroll event is not acceptable.

I have tried removing & clearing the img src attributes for images that are no longer in view, however, since the request was already started, the image continues to load.

Remember that the image src was filled in as the user briefly scrolled past that part of the page. Once past though, I couldn’t get that image from stop loading without using window.stop(). Clearing src didn’t work. (Chrome & FF)

Similar posts I found that get close, but don’t seem to solve this problem:

  • Stop loading of images with javascript (lazyload)?
  • Javascript: Cancel/Stop Image Requests
  • How to cancel an image from loading
  • 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-24T15:48:55+00:00Added an answer on May 24, 2026 at 3:48 pm

    What you are trying to do is the wrong approach, as mentioned by nrabinowitz. You can’t just “cancel” the loading process of an image (setting the src attribute to an empty string is not a good idea). In fact, even if you could, doing so would only make things worst, as your server would continually send data that would get cancelled, increasing it’s load factor and slow it down. Also, consider this:

    1. if your user scroll frenetically up and down the page, he/she will expect some loading delays.
    2. having a timeout delay (ex: 200 ms) before starting to load a portion of the page is pretty acceptable, and how many times will one stop and jump after 200 ms interval on your page? Even it it happens, it comes back to point 1
    3. how big are your images? Even a slow server can serve about a few tens of 3Kb thunbnails per second. If your site has bigger images, consider using low and hi resolution images with some components like lightBox

    Often, computer problems are simply design problems.

    ** EDIT **

    Here’s an idea :

    1. your page should display DIV containers with the width and height of the expected image size (use CSS to style). Inside of each DIV, add an link. For example :

      <div class="img-wrapper thumbnail">
         <a href="http://www.domain.com/path/to/image">Loading...</a>
      </div>
      
    2. Add this Javascript (untested, the idea is self describing)

      $(function() {
      
      var imgStack;
      var loadTimeout;
      
      $(window).scroll(function() {
         imgStack = null;
         if (loadTimeout) clearTimeout(loadTimeout);
      
         loadTimeout = setTimeout(function() {
      
            // get all links visible in the view port
            // should be an array or jQuery object
            imgStack = ...
      
            loadNextImage();
         }, 200);                // 200 ms delay
      });
      
      function loadNextImage() {
         if (imgStack && imgStack.length) {
            var nextLink = $(imgStack.pop());   // get next image element
      
            $('<img />').attr('src', nextLink.attr('href'))
              .appendTo(nextLink.parent())
              .load(function() {
                 loadNextImage();
              });
      
            // remove link from container (so we don't precess it twice)
            nextLink.remove();
         }
      };
      
      });
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very long-running stored procedure in SQL Server 2005 that I'm trying
I have a SQL query that takes a very long time to run on
In a C# application I am working on I have a very long identifier
i have very simple problem. I need to create model, that represent element of
We have a very lengthy newsletter that has been designed and developed to look
We have very strange problem, one of our applications is continually querying server by
I have very little experience building software for Windows, and zero experience using the
I have very simple select like this: SELECT * FROM table WHERE column1 IN
I have a very strange problem. Under some elusive circumstances I fail to apply
I have a very simple problem which requires a very quick and simple solution

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.