Last active
August 29, 2015 14:17
-
-
Save joshuadavidnelson/9fb31f2e26349d0bd4a5 to your computer and use it in GitHub Desktop.
This file contains 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
jQuery.noConflict(); | |
jQuery(document).ready(function(){ | |
var table = jQuery( document.getElementsByClassName('agenda') ); | |
var w = jQuery(window); | |
//Make a clone of our table | |
var fixedColumn = table.clone().insertBefore(table).addClass('fixed-column'); | |
//Remove everything except for first column | |
fixedColumn.find('th:not(:first-child),td:not(:first-child)').remove(); | |
function adjustColumnHeights() { | |
if( w.width() > 800 ) { | |
table.find('tbody tr.block-type-keynote').each(function (i, elem) { | |
// console.log('Keynote ' + i + ' height: ' + jQuery(this).height()); | |
jQuery(this).height(table.find('tbody tr.block-type-keynote:eq(' + i + ') .session-card').height() + 107); | |
// console.log('Adjusted Keynote ' + i + ' height: ' + jQuery(this).height()); | |
}); | |
fixedColumn.find('tbody tr.block-type-keynote').each(function (i, elem) { | |
//console.log('Keynote ' + i + ' height: ' + jQuery(this).height()); | |
jQuery(this).height(table.find('tbody tr.block-type-keynote td:eq(' + i + ')').height() + 39); | |
//console.log('Adjust Keynote ' + i + ' height: ' + jQuery(this).height()); | |
}); | |
//Match the height of the rows to that of the original table | |
fixedColumn.find('tbody tr').each(function (i, elem) { | |
//console.log('Row ' + i + ' height: ' + jQuery(this).height()); | |
jQuery(this).height(table.find('tbody tr:eq(' + i + ')').height()); | |
//console.log('Adjusted Row ' + i + ' height: ' + jQuery(this).height()); | |
}); | |
} else if( w.width() < 800 ) { | |
table.find('tbody tr.block-type-keynote').removeAttr('style'); | |
} | |
} | |
// Run on load | |
w.load(adjustColumnHeights); | |
// Run on resize | |
w.on('resize',adjustColumnHeights); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment