summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc/tableheader.js16
1 files changed, 3 insertions, 13 deletions
diff --git a/misc/tableheader.js b/misc/tableheader.js
index ed607e0f0..3143e14fc 100644
--- a/misc/tableheader.js
+++ b/misc/tableheader.js
@@ -10,23 +10,12 @@ Drupal.behaviors.tableHeader = function (context) {
var headers = [];
$('table thead:not(.tableHeader-processed)', context).each(function () {
- // Clone table and remove unwanted elements so it inherits original properties.
- var headerClone = $(this.parentNode).clone(true).insertBefore(this.parentNode).addClass('sticky-header').css({
+ // Clone thead so it inherits original jQuery properties.
+ var headerClone = $(this).clone(true).insertBefore(this.parentNode).wrap('<table class="sticky-header"></table>').parent().css({
position: 'fixed',
- visibility: 'hidden',
top: '0px'
});
- // Sets an id for cloned table header.
- var headerID = headerClone.attr('id');
- if (headerID != '') {
- headerClone.attr('id', headerID + '-header');
- }
-
- // Everything except thead must be removed. See theme_table().
- $('tbody', headerClone).remove();
- $('caption', headerClone).remove();
-
var headerClone = $(headerClone)[0];
headers.push(headerClone);
@@ -50,6 +39,7 @@ Drupal.behaviors.tableHeader = function (context) {
e.vPosition = $(e.table).offset().top;
e.hPosition = $(e.table).offset().left;
e.vLength = $(e.table).height();
+ e.resizeWidths = true;
}
// Track horizontal positioning relative to the viewport and set visibility.