riix
7/24/2012 - 6:10 AM

Document Resize Callback

Document Resize Callback

jQuery(document).ready(function() {

	// This will fire when document is ready:
	jQuery(window).resize(function() {

		// This will fire each time the window is resized:
		if(jQuery(window).width() >= 800) {

			// if larger or equal
			var colHeight = Math.max(
				jQuery('#main').height(),
				jQuery('#left').height(),
				jQuery('#right').height()
			);
			jQuery('#main, #left, #right').height(colHeight);

		} else {

			// if smaller
			jQuery('#main, #left, #right').removeAttr( 'style' );

		}
	}).resize(); // This will simulate a resize to trigger the initial run.
});