diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-09-30 06:02:05 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-09-30 06:02:05 +0000 |
commit | 99d5d3d67eaa9c3fb06a82efa8132326c882f40e (patch) | |
tree | 7300bd568d185c6169f1de3c431059e3e73a22af /misc | |
parent | dbafad09134a3240c9a05941f1cd2bff37cae9a1 (diff) | |
download | brdo-99d5d3d67eaa9c3fb06a82efa8132326c882f40e.tar.gz brdo-99d5d3d67eaa9c3fb06a82efa8132326c882f40e.tar.bz2 |
#184143 by redndahead: Fix #anchor tags conflicting with tableheader.js.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/tableheader.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/misc/tableheader.js b/misc/tableheader.js index 0f0e7de12..7f01d026f 100644 --- a/misc/tableheader.js +++ b/misc/tableheader.js @@ -35,6 +35,9 @@ Drupal.behaviors.tableHeader = function (context) { $(this).addClass('tableHeader-processed'); }); + // Define the anchor holding var. + var prevAnchor = ''; + // Track positioning and visibility. function tracker(e) { // Save positioning data. @@ -62,6 +65,16 @@ Drupal.behaviors.tableHeader = function (context) { var vOffset = (document.documentElement.scrollTop || document.body.scrollTop) - e.vPosition; var visState = (vOffset > 0 && vOffset < e.vLength) ? 'visible' : 'hidden'; $(e).css({left: -hScroll + e.hPosition +'px', visibility: visState}); + + // Check the previous anchor to see if we need to scroll to make room for the header. + // Get the height of the header table and scroll up that amount. + if (prevAnchor != location.hash) { + if (location.hash != '') { + var scrollLocation = $('td' + location.hash).offset().top - $(e).height(); + $('body, html').scrollTop(scrollLocation); + } + prevAnchor = location.hash; + } } // Only attach to scrollbars once, even if Drupal.attachBehaviors is called |