Cross Browser Drop-down Menus
3. Stay where you're put!
In the previous section we got a DIV (or layer) to pop up when the mouse was put over a link. We now need to make sure it appears where we want it to.
Test this page in Netscape 4.x. You;ll see the pop-up appears right under the link now.
What's changed to make this happen? In the DIV called "myLabel1" (the link that makes the pop-up appear) there's another transparent GIF file called "img". We can use this in Netscape 4.x to tell where the link is on the page (its page co-ordinates) and make the popup appear just under it.
The revised code is below (the functions "getImagePageLeft" and "getImagePageTop" are in the .js file for the menus):
In the next section we'll look at stringing three of these together to make a proper menu system.
|