function layoutMarginNotes() { var previousNote = null; $(".manchette").each(function() { if (previousNote != null && (previousNote.offset().top + previousNote.height() + 15 >= $(this).offset().top)) { $(this).css("top", (previousNote.offset().top + previousNote.height() + 6) + "px"); } previousNote = $(this); }); } // scroll table var $table = $('table.scroll'), $bodyCells = $table.find('tbody tr:first').children(), colWidth; // Adjust the width of thead cells when window resizes $(window).resize(function() { // Get the tbody columns width array colWidth = $bodyCells.map(function() { return $(this).width(); }).get(); // Set the width of thead columns $table.find('thead tr').children().each(function(i, v) { $(v).width(colWidth[i]); }); }).resize();