I\'m pretty much completely new to javascript, and I know there\'s already a similar question to this on here, but i would like the script as in.
if (user is at top of
I'm using a function to make it cross-browser compatible that can be found here: Cross-browser method for detecting the scrollTop of the browser window
function getScrollTop(){
if(typeof pageYOffset!= 'undefined'){
//most browsers
return pageYOffset;
}
else{
var B= document.body; //IE 'quirks'
var D= document.documentElement; //IE with doctype
D= (D.clientHeight)? D: B;
return D.scrollTop;
}
}
if(!getScrollTop()){
// user is at the top
}
Here is a little demo: http://jsfiddle.net/uDS4n/1/