Ver Mensaje Individual
  #4 (permalink)  
Antiguo 04/04/2007, 16:16
Avatar de Saruman
Saruman
 
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años, 8 meses
Puntos: 5
Re: Rollover menus, tengo problemas y quisiera solucionarlos.

debes setear el div flotante con respecto a la posición (coordenadas) de tu botón, para ello utiliza estas dos útiles funciones, que te ayudarán a saber en que posición exactamente está el botón para luego entonces utilizar los dos valores (x y y) para setearlos en el div flotante, a traves de style.top y style.left:

Código PHP:
function findPosX(obj) {
    
obj document.getElementById(obj);
    var 
curleft 0;
    if (
obj.offsetParent) {
        while (
obj.offsetParent) {
            
curleft += obj.offsetLeft
            obj 
obj.offsetParent;
        }
    }
    else if (
obj.x)
        
curleft += obj.x;
    return 
curleft;
}

function 
findPosY(obj) {
    
obj document.getElementById(obj);
    var 
curtop 0;
    if (
obj.offsetParent) {
        while (
obj.offsetParent) {
            
curtop += obj.offsetTop
            obj 
obj.offsetParent;
        }
    }
    else if (
obj.y)
        
curtop += obj.y;
    return 
curtop;

saludos
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.