Sha256: c43bfc8ab611d571c8da66e24757a7ac227094b2c34a914a36fa5d7f125d34ad
Contents?: true
Size: 508 Bytes
Versions: 2
Compression:
Stored size: 508 Bytes
Contents
$(function() { $('.horizontal-scroll > table').each(function() { // Get cell width from longest line in table let cellWidth = $(this) .find('th,td') .map(function() { return parseInt($(this).outerWidth()) }) .get() .reduce((a, b) => Math.max(a, b)) console.log('Table Cell Width:', cellWidth) // Set minimum width of table cell to width of longest element $(this).find('th,td').css('min-width', cellWidth) }) })
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll-theme-peaceful-gates-2.2.0 | assets/js/table-layout.js |
jekyll-theme-peaceful-gates-2.0.0 | assets/js/table-layout.js |