Click to See Complete Forum and Search --> : Height adjustment on window-Scroll and window-Resize


AbrarNazeer
April 9th, 2008, 11:47 PM
HTML Div's Height adjustment is required on window-Scroll and window-Resize both.
This Div is makes the whole HTML body as Clickable (Navigate to specified URL).

I use the following code ,

Body - Onload
document.getElementById('TestDiv').style.height = document.documentElement.clientHeight;

window.onresize = resize;
window.onscroll = scroll;

function resize()
{
if (document.documentElement.scrollTop == 0)
{document.getElementById('TestDiv').style.height = (document.documentElement.clientHeight * 2.175); }
else
{document.getElementById('TestDiv').style.height = (document.documentElement.clientHeight * 5);}

}


function scroll()
{
document.getElementById('TestDiv').style.top = document.documentElement.scrollTop + "px";
}

above code does not make the whole Page background as clickable on Resize and Scroll events.
If any Idea then please give me a chance of thanks

PeejAvery
April 10th, 2008, 06:44 AM
Why are you resizing it using JavaScript? Why don't you just use CSS? That way the browser would handle it for you.