문제

I'm looking for a way for javascript to tell how far a user has scrolled down the screen.

Instead of doing this through x, y coordinates is there a way to pull what's at the top of the viewport?

Either the text / line number or the current top element in the viewport?

도움이 되었습니까?

해결책

No, you can't. You have to set scroll events and update x and y values. Then, with those values, you can get the element at this position. https://developer.mozilla.org/en/DOM/document.elementFromPoint http://msdn.microsoft.com/en-us/library/ms536417%28VS.85%29.aspx

다른 팁

Have a look at jQuerys scrollTop()

This should probably do it for you:

$("body").scrollTop()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top