My page is long and requires the user to scroll to view the entire thing. I want the background (it's a CSS3 gradient) to stretch throughout the entire length of the page, even if the user resizes the window. I am using a bit of code from another thread that does this. However once I switch the page to fullscreen the background is cut off at the bottom. The code I am using is below.
function adjustBackground() {
var pageHeight = $('html').height();
var body = document.body,
html = document.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
document.getElementById("page-top").style.backgroundSize = "100% " + height + "px";
}
/*
page-top is the ID of the body.
The code gets the height of the page and should
set the height of the page to the height.
*/
$(document).ready(function(){
adjustBackground();
});
body.onresize=function(){
adjustBackground();
};