diff --git a/core/misc/tableheader.js b/core/misc/tableheader.js
index 63de30c..ee70aac 100644
--- a/core/misc/tableheader.js
+++ b/core/misc/tableheader.js
@@ -96,8 +96,10 @@ Drupal.tableHeader.prototype.eventhandlerRecalculateStickyHeader = function (eve
   if (this.stickyVisible && (calculateWidth || !this.widthCalculated)) {
     this.widthCalculated = true;
     // Resize header and its cell widths.
-    this.stickyHeaderCells.each(function (index) {
-      var cellWidth = self.originalHeaderCells.eq(index).css('width');
+    // Only apply width to visible table cells. This prevents the header from
+    // displaying incorrectly when the sticky header is no longer visible.
+    this.stickyHeaderCells.filter(':visible').each(function (index) {
+      var cellWidth = self.originalHeaderCells.filter(':visible').eq(index).css('width')
       $(this).css('width', cellWidth);
     });
     this.stickyTable.css('width', this.originalTable.css('width'));
