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 page) { (execute this function) }
Thanks in advance
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 page) { (execute this function) }
Thanks in advance
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
Here is a little demo: http://jsfiddle.net/uDS4n/1/
This is a little snippet I use to determine the scrolltop of a page, I can't remember where I got it, or whether I wrote it myself so can't credit it.
if st==0 then the user is at the top of the page!
Here's a clean solution that should make sense if you're new to JS: