user3752622
user3752622

Reputation: 11

image Height from position absolute div

Hello im trying to get image height from an position absolute image but if i try to get the image value outside of the function it returns 0?

http://jsfiddle.net/vvorqo2c/4/

console.log($('.inner-slider .active img').height());

Upvotes: 1

Views: 77

Answers (1)

Daniel A. White
Daniel A. White

Reputation: 190907

You should wait for the image to load. Here is a quick example.

$('img').on('load', function() {
   console.log($(this).height());
});

Upvotes: 4

Related Questions