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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:21:11+00:00 2026-05-27T16:21:11+00:00

after searching google i got a code which works but this code download all

  • 0

after searching google i got a code which works but this code download all the images at a time

code is

<script type="text/javascript">
  $(document).ready(function () {
      $("table[id*=dgImages] img").each(function () {
          $(this).attr("src", $(this).attr("original"));
          $(this).removeAttr("original");
      });
  });
</script>

<asp:DataList ID="dgImages" runat="server" RepeatColumns="4" RepeatDirection="Horizontal" RepeatLayout="Table">
      <ItemTemplate>
      <img src="images/ajax-loader.gif" original='<%# Eval("photos")%>' />
    </ItemTemplate>
</asp:DataList>

whatever the images are there in datalist the code download all at a time. so i need to customize it that only visible images should download and when user scroll down then next visible images should download.
so please guide me what to modify in my client script.

thanks

  • 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-27T16:21:12+00:00Added an answer on May 27, 2026 at 4:21 pm

    This will ensure that only visible images are downloaded:

    $(document).ready(function () {
      $("table[id*=dgImages] img").each(function () {
        if($(this).offset().top > $(window).scrollTop() && $(this).offset().top < $(window).scrollTop() + $(window).height()) {
    
          // callback on load complete          
          this.onload = function() { 
            alert('loaded'); 
            $(this).fadeIn('slow');
          }
    
          $(this).attr("src", $(this).attr("original"));
          $(this).removeAttr("original");
        }
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i got a script after searching google for Edit Image FaceBook Style but found
thanks for your time first...after all the searching on google, github and here, and
I am struggling to push my code to Heroku. And after searching on Google
I've seen this question asked over at the Raphael Google Groups, but after hours
After searching a long time for a performance bug, I read about denormal floating
First attempt to use this cool site - after searching for 2 hours: So
I came across this question after searching for a ODBC or JDBC. To my
I am really posting this out of desperation after searching around a lot for
Partials in XML builder are proving to be non-trivial. After some initial Google searching,
I'm no php expert (a mere beginner) but need some help! After hours searching

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.