examOnline/WebRoot/js/responsive-tables.js
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
jQuery(document).ready(function() {
var switched = false;
var updateTables = function() {
if ((jQuery(window).width() < 960) && !switched ){
switched = true;
jQuery("table.responsive").each(function(i, element) {
splitTable(jQuery(element));
});
return true;
}
else if (switched && (jQuery(window).width() > 960)) {
switched = false;
jQuery("table.responsive").each(function(i, element) {
unsplitTable(jQuery(element));
});
}
};
jQuery(window).load(updateTables);
jQuery(window).on("redraw",function(){switched=false;updateTables();}); // An event to listen for
jQuery(window).on("resize", updateTables);
function splitTable(original)
{
original.wrap("<div class='table-wrapper' />");
var copy = original.clone();
copy.find("td:not(:first-child), th:not(:first-child)").css("display", "none");
copy.removeClass("responsive");
original.closest(".table-wrapper").append(copy);
copy.wrap("<div class='pinned' />");
original.wrap("<div class='scrollable' />");
setCellHeights(original, copy);
}
function unsplitTable(original) {
original.closest(".table-wrapper").find(".pinned").remove();
original.unwrap();
original.unwrap();
}
function setCellHeights(original, copy) {
var tr = original.find('tr'),
tr_copy = copy.find('tr'),
heights = [];
tr.each(function (index) {
var self = jQuery(this),
tx = self.find('th, td');
tx.each(function () {
var height = jQuery(this).outerHeight(true);
heights[index] = heights[index] || 0;
if (height > heights[index]) heights[index] = height;
});
});
后面还有 7 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。