Keep two divs sync scroll and example
srcDiv has visible horizontal scrollbar.(style="overflow:auto;")
targetDiv has no scrollbar.(style="overflow:hidden;")
For instance, srcDiv is a tableview without tableheader, targetDiv is a tableheader only. When horizontally scrolling srcDiv, header div should scroll the the same distance accordingly.
function syncDivsScrollPos() { $('#srcDiv').on('scroll', function () { $('#targetDiv').scrollLeft($(this).scrollLeft()); }); }