Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:32
Absolute Positioning of Menu relative to image on page
Poster: pinchio
Dated: Sunday April 18 2004 - 1:56:25 BST
In the past when faced with placing a dhtml layer on a centered web page I've used the getElementById() method in javascript as a method to retrieve the DOM object reference to an image used as a "anchor". This image could be any image on the page, but a guideline would be to use an image that does not change position relative to the menu no matter how the browser is stretched (i.e. it will always be X pixels to the right and Y pixels down), I've always used a sites logo.
Once I have the DOM reference to this image I then retrieve the X and Y coordinates of that image. I then proceed to add on the appropriate amount of pixels for each coordinate to determine the LEFT and TOP positions of the DTML layer. Since the logo will always move relative to the browser being resized I can rely on the DHTML layer to move in proportion to the logo.
I'm being real lazy right now and before I attempt to code that I was wondering has anyone else used this technique for relative positioning before with Milonic Menu? It was a while now since I used that technique and I remember something with determining what browser is being used since getElementById does not work in browsers or something like that.
Can others please weigh in here. If this could work then it would make fore a real nice function call to include as an option when a user wishes to uses relative positioning.
Thanks
Rob Mitchell
Manager, Web Services
March Networks