Forum Moderators: open
Can someone please give me a simple function to add in my script. That will...
Here is what the ENTIRE script looks like currently.
<script type="text/javascript">
<!--
function getWindowHeight() {
var windowHeight = 0;
if (typeof(window.innerHeight) == 'number') {
windowHeight = window.innerHeight;
}
else {
if (document.documentElement && document.documentElement.clientHeight) {
windowHeight = document.documentElement.clientHeight;
}
else {
if (document.body && document.body.clientHeight) {
windowHeight = document.body.clientHeight;
}
}
}
return windowHeight;
}function setContent() {
if (document.getElementById) {
var windowHeight = getWindowHeight();
if (windowHeight > 0) {
var contentElement = document.getElementById('window');
var contentHeight = contentElement.offsetHeight;
if (windowHeight - contentHeight > 0) {
contentElement.style.position = 'relative';
contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
}
else {
contentElement.style.position = 'static';
}
}
}
}window.onload = function() {
setContent();
}
window.onresize = function() {
setContent();
}
//-->
</script>
This is the css for "rightground"
#rightground {
display: block;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-image: url(rightground.png);
background-position: top right;
background-repeat: repeat-y;
z-index: 0;
}
function setGround() {
if (document.getElementById) {
var groundHeight = getWindowHeight();
if (groundHeight > 0) {
var groundElement = document.getElementById('rightground');
groundElement.style.height = groundHeight + 'px';
}
}
}
Don't forget
window.onload = function() {setGround();}