js.jquery.scrollTableBody.jquery.scrollTableBody-1.0.0.min.js Maven / Gradle / Ivy
(function(c){var e={rowsToDisplay:10};c.fn.scrollTableBody=function(f){f=c.extend(e,f);var i=this;b(i,f);d(i);var h=function(){a(i)};var g=typeof _=="function"&&typeof _.debounce=="function";if(g){h=_.debounce(h,150)}c(window).resize(h)};function b(l,n){var i=l.attr("class");var m=l.css("margin-bottom");l.css("margin-bottom",0);var f=l.find("tbody tr:first").outerHeight();var g=f*n.rowsToDisplay;var k=c('
'),j=c('
'),h='';l.before(k).before(h).after(j)}function d(f){f.each(function(g){var h=c(this);var j=c("table.jqstb-header-table").eq(g);var i=c("table.jqstb-footer-table").eq(g);c("div.jqstb-scroll").eq(g).prepend(h);h.find("thead tr:first th, tbody tr:first td").each(function(){c(this).outerWidth(c(this).outerWidth())});j.find("thead").replaceWith(h.children("caption, thead").clone());h.find("tfoot tr:first td").each(function(){c(this).outerWidth(c(this).outerWidth())});i.find("tfoot").replaceWith(h.children("tfoot").clone());h.children("caption, thead, tfoot").hide()})}function a(f){f.each(function(g){var h=c(this);var l=c("table.jqstb-header-table").eq(g);var k=c("table.jqstb-footer-table").eq(g);h.children("thead, tfoot").show();var j=l.find("thead tr:first th");h.find("thead tr:first th").each(function(m){j.eq(m).outerWidth(c(this).outerWidth())});var i=k.find("tfoot tr:first td");h.find("tfoot tr:first td").each(function(m){i.eq(m).outerWidth(c(this).outerWidth())});h.children("thead, tfoot").hide()})}})(jQuery);