Hey,
I am working on a drop down menu in JavaScript and all is going well, except for aligning the menu underneath the object I want it to appear under. The problem is that I have set the 'left' attribute as a set number (say 200 pixels) which is fine for the resolution I am working in.
However, if I resize the window, then 200 pixels places the menu beyond the image I want it to be placed under. I am basically wondering if it is possible for an element to return its style.left attribute so that I can realign the menu on resize?
Something like:
---------------
document.getElementById('Menu1').style.left = document.getElementById('Image1').style.left;
I have tried the above but it doesn't actually work. I have set:
---------------
document.getElementById('Image1').style.left = 200;
document.getElementById('Menu1').style.left = document.getElementById('Image1').style.left;
which works but I want it to dynamically get the style.left value so the menu will move around the screen with the image when resized.
Hope I have been clear enough for you, and I hope you can help me too
Thanks for you time,
Peter
I am working on a drop down menu in JavaScript and all is going well, except for aligning the menu underneath the object I want it to appear under. The problem is that I have set the 'left' attribute as a set number (say 200 pixels) which is fine for the resolution I am working in.
However, if I resize the window, then 200 pixels places the menu beyond the image I want it to be placed under. I am basically wondering if it is possible for an element to return its style.left attribute so that I can realign the menu on resize?
Something like:
---------------
document.getElementById('Menu1').style.left = document.getElementById('Image1').style.left;
I have tried the above but it doesn't actually work. I have set:
---------------
document.getElementById('Image1').style.left = 200;
document.getElementById('Menu1').style.left = document.getElementById('Image1').style.left;
which works but I want it to dynamically get the style.left value so the menu will move around the screen with the image when resized.
Hope I have been clear enough for you, and I hope you can help me too
Thanks for you time,
Peter