Hello,
I am trying to add classes to each image depending to its proportions (landscape/portrait/square). This code works in JSfiddle but not on the website (locally or on server):
$(document).ready(function()
{
$('img').addClass('wide');
$.each($('img'), function()
{
var image = $(this);
if (image.height() > image.width()) {
image.removeClass('wide');
image.addClass('tall');
} else if (image.height == image.width()) {
image.removeClass('wide');
image.addClass('square');
}
});
});
Here is my JSfiddle: http://jsfiddle.net/LYxv6/ .