Skip to content

Instantly share code, notes, and snippets.

@cantino
Created November 27, 2010 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cantino/718228 to your computer and use it in GitHub Desktop.
Save cantino/718228 to your computer and use it in GitHub Desktop.
class Utilities
@findPos: (obj) ->
obj = obj.get(0) if obj.html?
curLeft = curTop = 0
if obj.offsetParent
loop
curLeft += obj.offsetLeft
curTop += obj.offsetTop
break unless obj = obj.offsetParent
{ x: curLeft, y: curTop }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment