Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save riix/3168320 to your computer and use it in GitHub Desktop.
Save riix/3168320 to your computer and use it in GitHub Desktop.
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.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment