I'm trying to get the width and height of certain images equal (or, more specific: the div around it), but somehow it doesn't seem to work.. Anyone who can help?
$('.a2paragraph .image img').each(function() {
var img = $('.a2paragraph .image img');
var h = img.height(),
w = img.width();
if (h > w) {
img.parent().css('height', w);
}
else if (w < h) {
img.parent().css('width', h);
}
});
EDIT: changed the code, but still not working:
$('.a2paragraph .image img').each(function() {
var img2 = $('.a2paragraph .image img');
var h = img2.height(),
w = img2.width();
if (h > w) {
img2.parent().css('height', w);
}
else if (h < w) {
img2.parent().css('width', h);
}
})