Use each() function to Custom Style Matching Classes

In the attached example, an each function is used to equalize the heights of the containers based on the width of the columns so the images will show in equal size.

This allows for the same type of element to be setup multiple ways without additional classes / css.

jQuery(window).load(function(){
	
	jQuery('.logo-wrapper').each(function() {
		jQuery(this).find('.logo-image-div').height(jQuery(this).find('.logo-image-div').width()/2);
	});
	
	
	
	jQuery(window).resize(function(){
		jQuery('.logo-wrapper').each(function() {
			jQuery(this).find('.logo-image-div').height(jQuery(this).find('.logo-image-div').width()/2);
		});
	});
});

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.