Returns a function which yields element position in target coordinate space with optional scaling.
Live position is calculated when the function is invoked.
Use positionRelative to simply get relative position of element in given coordinate space.
Example: Absolute position of #blah in viewport coordinate space
This function is useful if you have a stable DOM element and conversion target.
If the DOM element is changing continually, consider using viewportToSpace to
convert from viewport coordinates to target coordinates:
// Eg.1 Absolute coords in screen space constvpToScreen = viewportToSpace('screen'); vpToScreen(el.getBoundingClientRect());
Returns a function which yields element position in target coordinate space with optional scaling. Live position is calculated when the function is invoked. Use positionRelative to simply get relative position of element in given coordinate space.
Example: Absolute position of #blah in viewport coordinate space
Example: Relative position of element in viewport-space
Example: Relative position of #blah in screen-space
By default, top-left corner (north west) is used. Other cardinal points or 'center' can be specified:
This function is useful if you have a stable DOM element and conversion target. If the DOM element is changing continually, consider using viewportToSpace to convert from viewport coordinates to target coordinates: