Created
September 8, 2014 16:51
-
-
Save OatmealBath/8d7a149232f18790b4e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DEFINE FUNCTION TO KEEP TWO COLUMNS THE SAME HEIGHT | |
function matchColumnHeight(divone, divtwo, debug){ | |
if(jQuery(divone).length > 0 && jQuery(divtwo).length > 0){ | |
if(debug){ | |
console.log("Div One Original Height: "+jQuery(divone).outerHeight()); | |
console.log("Div Two Original Height: "+jQuery(divtwo).outerHeight()); | |
} | |
if(jQuery(divone).outerHeight() > jQuery(divtwo).outerHeight()){ | |
jQuery(divtwo).css('min-height',jQuery(divone).outerHeight()); | |
} else { | |
jQuery(divone).css('min-height',jQuery(divtwo).outerHeight()); | |
} | |
if(debug){ | |
console.log("Div One New Height: "+jQuery(divone).outerHeight()); | |
console.log("Div Two New Height: "+jQuery(divtwo).outerHeight()); | |
} | |
} | |
} | |
// ON WINDOW LOAD MATCH HEIGHTS | |
jQuery(window).load(function(){ | |
matchColumnHeight('INSERT FIRST CLASS OR ID HERE','INSERT SECOND CLASS OR ID HERE',false); | |
}); | |
// ON WINDOW RESIZE MATCH HEIGHTS | |
jQuery(window).resize(function(){ | |
matchColumnHeight('INSERT SECOND CLASS OR ID HERE','INSERT SECOND CLASS OR ID HERE',false); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment