Freitag, 5. Februar 2010

logo links unten - aber bitte nicht über die navigation

Fürs JavaScript:

function getScrollWidth() {
var w = window.pageXOffset || document.body.scrollLeft;
return w ? w : 0;
}

function getScrollHeight() {
var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
return h ? h : 0;
}


function showLogo() {
var naviHeight= window.document.getElementById('navigation').offsetHeight;

var bodyHeight = document.body.clientHeight;
var vertiScroll = getScrollWidth();
var spaceForLogo = bodyHeight - naviHeight ;
var whiteSpaceLogo = 140;


if ((spaceForLogo < whiteSpaceLogo) || (vertiScroll > 50)) {

window.document.getElementById('leftDown').style.display = 'none';
}

if ((whiteSpaceLogo < getScrollHeight() || spaceForLogo > whiteSpaceLogo) && (vertiScroll < 50) ){

window.document.getElementById('leftDown').style.display = 'block';
}


return true;

}

showLogo();

Im CSS

.leftDown {
bottom:10px;
position:fixed;
}

Für den body-Tag
onResize="showLogo();" onscroll="showLogo();"

Na dann, allzeit angstfreies scrollen

Keine Kommentare:

Kommentar veröffentlichen