so i'm trying to do a image gallery with a li container and an image inside, setting this image width, or height according to the original image size on it, this is how far i got.
<ul>
<li><a><img class='imgGal' src='oneHorizontalImg.jpg'></a></li>
<li><a><img class='imgGal' src='oneVerticalImg.jpg'></a></li>
<li><a><img class='imgGal' src='anotherHorizontalImg.jpg'></a></li>
</ul>
and the javascript part
if ( $('.imgGal').height() > $('.imgGal').width() ) {
$('.imgGal').css('width','100%'); }
else {
$('.imgGal').css('height','100%');
};
but for some reason even with me setting this code on the bottom of the page when i do a alert($('.imgGal').height()); or alert($('.imgGal').width()) i get the return value of 0, so no matter what the conditional is, the else is always applyed.
also, one other thing i'm not sure how it will turn out is how could i do to apply different results according to each img.
anyway, thanks in advance for all the help.