I am using Google’s closure library for a project and want to find the position of a given element on the page. Basically I want to do what Quirksmode findPos() does:
http://www.quirksmode.org/js/findpos.html
I’ve looked through Google’s documentation for positioning:
http://closure-library.googlecode.com/svn/docs/namespace_goog_positioning.html
…but I can’t find anything related to obtaining an element’s current position. Does the library provide a solution or should I resort to native javascript to handle this?
The function you’re looking for resides in
goog.style, I’m pretty suregoog.style.getPageOffsetis what you want.