Jump to content
xisto Community
iGuest

Getting Absolute Position Of Non-absolute Elements

Recommended Posts

Hi. Recently I've been working on a slightly new design of my website, that includes a new menu-oriented menu system, because I was running out of room in the navigation bar. How the system works, is you put the mouse over a link, and a menu drops down with all the links in that category.Most of this is working perfectly. I can get the menu to popup and go away, and it appears perfectly. The one thing wrong with it is I can't get it to appear in the right place. Every link in the navigation bar is in it's own td, and all tds have a unique id (navtd1, navtd2, etc.).How can I get the position of the td, when it isn't absolute? I had a look through a JavaScript reference pdf, and there were a few functions like pixelLeft, pixelRight that looked promising, but they didn't work, and were only for IE anyway.Does anyone know how to get the position?

Share this post


Link to post
Share on other sites

well theres always just making them absolute? thats probably not gonna work but if it was dumb me that would be the first thing id do, lol.

Share this post


Link to post
Share on other sites

To determine the mouse event location in the coordinate plane of the entire document, you can use the pageX and pageY properties of the Netscape event object. For IE, you can use the clientX and clientY properties in conjunction with the scrollLeft, scrollTop, clientLeft and clientTop properties.

Take a look to the following topic: Get Mouse Position to get some more information and check out the getPageEventCoords() and the getPositionedEventCoords() functions in my post that i think that can help you.

getPageEventCoords function

Best regards,

Share this post


Link to post
Share on other sites

that css play site is nice, lots of good stuff

 

on that site, i reckon habble needs this one for what he needs, though i think hes just using text links, not sure

Share this post


Link to post
Share on other sites

I agree with jlhaslip and Sten the cssplay website is an amazing website with lots of good stuf and examples, i forgot it in my previous post.

 

The drop-down using images and text that Sten mention is very cute, maybe i will use it for a new project that i just start.

 

Best regards,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.