From f70b6182e136a66039711f6a452fd582698f3dd9 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Tue, 15 Sep 2009 20:50:48 +0000 Subject: [PATCH] =?UTF-8?q?-=20Patch=20#520368=20by=20G=C3=A1bor=20Hojtsy:?= =?UTF-8?q?=20fixed=20Admin=20toolbar=20breaks=20sticky=20table=20headers.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- misc/tableheader.js | 5 ++++- modules/toolbar/toolbar.js | 4 ++++ modules/toolbar/toolbar.module | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/misc/tableheader.js b/misc/tableheader.js index 52f6b6d33e39..1b772af3ca7e 100644 --- a/misc/tableheader.js +++ b/misc/tableheader.js @@ -41,11 +41,14 @@ Drupal.behaviors.tableHeader = { // Track positioning and visibility. function tracker(e) { + // Reset top position of sticky table headers to the current top offset. + var topOffset = Drupal.settings.tableHeaderOffset ? eval(Drupal.settings.tableHeaderOffset + '()') : 0; + $('.sticky-header').css('top', topOffset + 'px'); // Save positioning data. var viewHeight = document.documentElement.scrollHeight || document.body.scrollHeight; if (e.viewHeight != viewHeight) { e.viewHeight = viewHeight; - e.vPosition = $(e.table).offset().top - 4; + e.vPosition = $(e.table).offset().top - 4 - topOffset; e.hPosition = $(e.table).offset().left; e.vLength = e.table.clientHeight - 100; // Resize header and its cell widths. diff --git a/modules/toolbar/toolbar.js b/modules/toolbar/toolbar.js index c2653d91a671..50a60a796299 100644 --- a/modules/toolbar/toolbar.js +++ b/modules/toolbar/toolbar.js @@ -80,4 +80,8 @@ Drupal.admin.toolbar.toggle = function() { } } +Drupal.admin.toolbar.height = function() { + return $("#toolbar").height(); +} + })(jQuery); diff --git a/modules/toolbar/toolbar.module b/modules/toolbar/toolbar.module index 6b931632a379..f883588f0573 100644 --- a/modules/toolbar/toolbar.module +++ b/modules/toolbar/toolbar.module @@ -65,6 +65,10 @@ function toolbar_build() { 'js' => array( $module_path . '/toolbar.js', array('data' => 'misc/jquery.cookie.js', 'weight' => JS_LIBRARY + 2), + array( + 'data' => array('tableHeaderOffset' => 'Drupal.admin.toolbar.height'), + 'type' => 'setting' + ), ), 'css' => array( $module_path . '/toolbar.css', -- GitLab