diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/drupal.js | 11 | ||||
-rw-r--r-- | misc/tableheader.js | 8 |
2 files changed, 17 insertions, 2 deletions
diff --git a/misc/drupal.js b/misc/drupal.js index ea688a499..87a5972c6 100644 --- a/misc/drupal.js +++ b/misc/drupal.js @@ -344,4 +344,15 @@ Drupal.theme.prototype = { } }; +/** + * Return whether the given variable is an object. + * + * The HEAD version of jQuery (http://code.jquery.com/jquery-nightly.js) + * includes an isObject() function, so when that gets released and incorporated + * into Drupal, this can be removed. + */ +$.extend({isObject: function(value) { + return (value !== null && typeof value === 'object'); +}}); + })(jQuery); diff --git a/misc/tableheader.js b/misc/tableheader.js index 813e4c7ca..0192d30b2 100644 --- a/misc/tableheader.js +++ b/misc/tableheader.js @@ -18,8 +18,9 @@ Drupal.behaviors.tableHeader = { var headers = []; $('table.sticky-enabled thead', context).once('tableheader', function () { - // Clone thead so it inherits original jQuery properties. - var headerClone = $(this).clone(true).insertBefore(this.parentNode).wrap('<table class="sticky-header"></table>').parent().css({ + // Clone the table header so it inherits original jQuery properties. Hide + // the table to avoid a flash of the header clone upon page load. + var headerClone = $(this).clone(true).hide().insertBefore(this.parentNode).wrap('<table class="sticky-header"></table>').parent().css({ position: 'fixed', top: '0px' }); @@ -32,6 +33,9 @@ Drupal.behaviors.tableHeader = { headerClone.table = table; // Finish initializing header positioning. tracker(headerClone); + // We hid the header to avoid it showing up erroneously on page load; + // we need to unhide it now so that it will show up when expected. + $(headerClone).children('thead').show(); $(table).addClass('sticky-table'); }); |