the following line sets the 'y' position of the DIV.
active_menu.style.top = position.y + active_img.offsetHeight;
so, you can account for your effects by calculating the amount of pixels from the actual image (or where you want the menu to lay) from total height of the image... for instance, if your drop shadow effects and such took up 15px then you would say
active_menu.style.top = position.y + active_img.offsetHeight - 15; // 15px offset for image effects
remember it's always best to put this amount into a variable so you don't have what we coders refer to as "magic numbers"
so...
Code:
var menuimg_offset = 15; // 15px offset
// ... all of your code ...
// inside the show_menu function change the line
active_menu.style.top = position.y + active_img.offsetHeight - menuimg_offset;
// ... rest of your code ...
this way you can reuse the script and set the 'menuimg_offset' to 0 if you like, or change it up.
|