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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:05:22+00:00 2026-05-28T15:05:22+00:00

Title pretty much explains most of my question. I will provide some context. I’ve

  • 0

Title pretty much explains most of my question. I will provide some context.

I’ve got something like this. (simplified)

<ul>
<li><img src="image1.jpg"/></li>
<li><img src="image2.jpg"/></li>
<li><img src="image3.jpg"/></li>
</ul>

each li is tiled up horizontally. Like so:

 [   ][   ][   ][   ]

So I already have this script that stretches the image height and keeps the aspect ratio.
But now I need a script which will dynamically get width of all the images (or li) even after the browser has been resized.
To my understanding I need something like event bubbling or delegation of some sort. I have no idea how to continue this jQuery journey.

image links to different browser settings I’m talking about

Normal browser height

http://f.cl.ly/items/1O3w3M3l3b3a0z2B0U1w/image1.jpg

Decreased browser height

http://f.cl.ly/items/3y3K38243J063J1U2f1P/image2.jpg

  • 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-28T15:05:23+00:00Added an answer on May 28, 2026 at 3:05 pm

    You’ll have to hook into the resize event:

    $(window).resize(function(){
        $('li img').each(function(){
            console.log( $(this).width() );
        });
    });
    

    If you want it to also fire on page load, trigger the resize event yourself:

    $(window).resize(function(){
        $('li img').each(function(){
            console.log( $(this).width() );
        });
    })
    .resize();
    

    Here’s the fiddle: http://jsfiddle.net/39JFQ/


    If you need the total of all the widths, use this:

    $(window).resize(function(){
        var totalWidths = 0;
    
        $('li img').each(function(){
            totalWidths += $(this).width();
        });
    
        console.log(totalWidths);
    })
    .resize();
    

    Here’s the fiddle for that: http://jsfiddle.net/39JFQ/2/


    You should obviously replace the li img selector with something more specific.

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

Sidebar

Related Questions

The title pretty much explains my question. I would like to be able to
Well the title explains pretty much everything. I want to use something like p
The title pretty much explains it. I need some way to keep using body
The title pretty much explains the question. I have a user control loaded into
The title pretty much says it all. If I have something like (from PHP
So The title pretty much explains my question. What is the difference between stdout=subprocess.PIPE
Title pretty much explains it all. I need to get some hardware information such
the title pretty much explains it. Please note that this is a WebKit-specific issue
The title pretty much says it all. Some caveats are: I need to be
The title pretty much asks the whole question - How can I clear ONLY

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.