MediaWiki:Navigation.js: Unterschied zwischen den Versionen

Zur Navigation springen Zur Suche springen
 
K
Zeile 1: Zeile 1:
var nv=''; // s. window.onload ...
+
var nv = document.getElementById('siteNotice');  
  
 
function findPos(b) {  //Position von b ( = nv) ermitteln
 
function findPos(b) {  //Position von b ( = nv) ermitteln

Version vom 4. Januar 2012, 16:18 Uhr

var nv = document.getElementById('siteNotice'); 

function findPos(b) {  //Position von b ( = nv) ermitteln
  var a = 0;
  if(b.offsetParent)
    for(a = b.offsetTop;b = b.offsetParent;)
      a += b.offsetTop;
  return[a];
}

function fixNv() {	
    //Scrollposition ermitteln	
  var scrY = document.documentElement.scrollTop || // Explorer 6 Strict
	document.body.scrollTop || //all other Explorers
	self.pageYOffset ||
	0;
  if(self.pageYOffset)
    scrY = self.pageYOffset;
  else if(document.documentElement && document.documentElement.scrollTop)
    scrY = document.documentElement.scrollTop;
  else if(document.body)
    scrY = document.body.scrollTop;
  if(typeof document.body.style.maxHeight != "undefined" && nv!='') // nur neuere Browser
    nv.parentNode.className = scrY > nvY - 16 ? "fixed" : "absolute";
}

function styleNv() {
  var selflink = document.getElementById('chapters').getElementsByTagName('STRONG')[0]||0;
  if (selflink && selflink.parentNode.parentNode.parentNode.parentNode.tagName == 'LI') {
    selflink.parentNode.parentNode.parentNode.parentNode.className='self_parent';
  }  
}
window.onscroll = fixNv;