From f557a732caaeab396fb90d5834eb28f5b3040cf4 Mon Sep 17 00:00:00 2001 From: "J.C. Bartle" Date: Sun, 7 May 2017 17:14:14 -0400 Subject: [PATCH 1/2] Fix incompatibility with jQuery 3.x (tested with jquery-3.2.1). --- responsive-tables.js | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/responsive-tables.js b/responsive-tables.js index 1a862f1..d777a90 100644 --- a/responsive-tables.js +++ b/responsive-tables.js @@ -1,4 +1,4 @@ -$(document).ready(function() { +$(function() { var switched = false; var updateTables = function() { if (($(window).width() < 767) && !switched ){ @@ -16,31 +16,29 @@ $(document).ready(function() { } }; - $(window).load(updateTables); + $(window).on('load', updateTables); $(window).on("redraw",function(){switched=false;updateTables();}); // An event to listen for - $(window).on("resize", updateTables); - - - function splitTable(original) - { - original.wrap("
"); - - 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("
"); - original.wrap("
"); + $(window).on("resize", updateTables); + + function splitTable(original) { + original.wrap("
"); + + 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("
"); + original.wrap("
"); setCellHeights(original, copy); - } - - function unsplitTable(original) { + } + + function unsplitTable(original) { original.closest(".table-wrapper").find(".pinned").remove(); original.unwrap(); original.unwrap(); - } + } function setCellHeights(original, copy) { var tr = original.find('tr'), @@ -63,5 +61,4 @@ $(document).ready(function() { $(this).height(heights[index]); }); } - -}); +}); \ No newline at end of file From ec86d2337740c2de91edca921a7a81ea80c7fb4e Mon Sep 17 00:00:00 2001 From: FireFlying Date: Sun, 7 May 2017 17:16:37 -0400 Subject: [PATCH 2/2] Create README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ae031c --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# responsive-tables +Tables that work responsively on small devices. +This fork was created in order to fix the incompatibility of this project with jQuery 3.x.