The script goes here : getScroll.js
[codesyntax lang=”javascript”]
// get scroll information (cross-browser compatibility)
function getScroll()
{
// t for top, l for left, w for width, h for height
var t, l, w, h;
if (document.documentElement && document.documentElement.scrollTop) {
// IE6 standards compliant
t = document.documentElement.scrollTop;
l = document.documentElement.scrollLeft;
w = document.documentElement.scrollWidth;
h = document.documentElement.scrollHeight;
} else if (document.body) {
// DOM compliant
t = document.body.scrollTop;
l = document.body.scrollLeft;
w = document.body.scrollWidth;
h = document.body.scrollHeight;
} else if (typeof(window.pageYOffset) == 'number') {
// Netscape compliant
t = window.pageYOffset;
l = window.pageXOffset;
w = window.innerWidth;
h = window.innerHeight;
} else {
alert('Error!');
}
return {t: t, l: l, w: w, h: h};
}
[/codesyntax]