Mercurial > defr > drupal > core
diff misc/tableheader.js @ 11:589fb7c02327 6.5
Drupal 6.5
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:32:19 +0100 |
parents | c1f4ac30525a |
children |
line wrap: on
line diff
--- a/misc/tableheader.js Tue Dec 23 14:32:08 2008 +0100 +++ b/misc/tableheader.js Tue Dec 23 14:32:19 2008 +0100 @@ -1,4 +1,4 @@ -// $Id: tableheader.js,v 1.16 2008/01/30 10:17:39 goba Exp $ +// $Id: tableheader.js,v 1.16.2.1 2008/10/01 23:30:36 goba Exp $ Drupal.tableHeaderDoScroll = function() { if (typeof(Drupal.tableHeaderOnScroll)=='function') { @@ -35,6 +35,9 @@ $(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 @@ 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