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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:09:25+00:00 2026-06-03T04:09:25+00:00

I have a set of images that are responsive to the page (i.e. max-width

  • 0

I have a set of images that are responsive to the page (i.e. max-width set to 100% ).

<div class="exh">
   <img src="#" />
</div>
<div class="exh">
   <img src="#" />
</div>
<div class="exh">
   <img src="#" />
</div>

with

.exh img {
   max-width:100%;
}

How do I retrieve the height of the image after the window is resized and whenever the page is loaded? When I use the following, I get a height of 0.

$(".exh img").each(function() {
    var $this = $(this);
    console.log( $this.height() );
});
  • 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-06-03T04:09:26+00:00Added an answer on June 3, 2026 at 4:09 am

    per this answer I gave to a similar question :

    Why does jQuery.css('width') return different values in different browsers?

    .width() or height() is the “rendered in the DOM” size of the element – and for it to return a value greater than 0, the element needs to be fully available to the DOM ( aka the image needs to be fully loaded )

    What you want is :

    var myImage= new Image();
    myImage.onload=function() { alert(this.height);}
    myImage.src= "your/image/url";
    

    In short – you need to guarantee that the image has loaded before you call height()

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

Sidebar

Related Questions

I have a set of images that when moused over need to change to
I have a set of images that have to be desaturated on load and
I have a loop that fades between images, with an interval set by the
I have a page that has to render a huge set of query results
I have an image (PNG file) that has an alpha channel that is set
I have a 1px wide by 35px high image, that I set as background
I have a set of images in a folder call 'uploads/', all the files
I have one AlertDialog which is working fine.I have set some background images to
I'm trying to do the following: I have a set of images and select
I have a set of small images which is working fine in Firefox but

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.