Created
January 25, 2009 04:24
-
-
Save davglass/51683 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getPosition(el) { | |
| if (el.getBoundingClientRect) { | |
| //They have getBoundingClientRect | |
| var box = el.getBoundingClientRect(); | |
| if (typeof arguments.callee.offset != "number") { | |
| var temp = document.createElement("div"); | |
| temp.style.cssText = "position:absolute;top:0;left:0"; | |
| document.body.appendChild(temp); | |
| arguments.callee.offset = -temp.getBoundingClientRect().top; | |
| document.body.removeChild(temp); | |
| temp = null; | |
| } | |
| } else { | |
| //Other Browsers here.. | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment