/    Sign up×
Community /Pin to ProfileBookmark

Get object Coordinates

I was wondering how to capture the coordinates of a table, image, or div. Something like getBoundingClientRect() but I need it to work with IE4+, MAC, and if possible ns 4.79.

FYI: I am trying to modify an existing piece of NAV menu JS code which currently accepts absolute coordinates.

ex.(this is what exisits now)
showSubMenu(name, …. width, topPosition, leftPosition, visiblity….etc.);

currently the topPosition, and leftPosition pass as numbers so I was hoping that to make it relatively positioned I could do something like:
showSubMenu(name…,width, parentLayer.top + 20, parentLayer.left + 5,…etc.);

this way obviously i am still passing numbers yet they are relative to where the parent layer (top level) of the menu.

to do this i need to get the coordinates of the parent table/layer/div itself, or an image in the parent table… see what I mean?

Sorry I suck at JS……(hehe)(sigh…)

Any help is GREATLY appreciated!
– Shu

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@VladdyMar 31.2004 — Using JS for site navigation is a [b]bad idea[/b].

Going to a simple list of links will solve quite a few problems, some that you do not even know about...
×

Success!

Help @shuD spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...