J
jon23d
Good afternoon,
I am trying to get a pop-up div to position itself relative to the
mouse position when a user clicks on a link. The positioning is
working fine in every browser except IE where it is positioned properly
on the left, but not the top is at the very top of the page instead of
at tempx-175px... Here is my code, can anyone see what I am doing
wrong?
function revealMenu(e, elementID){
// get x,y
if (document.all) {
// for IE
tempX = e.clientX + document.body.scrollLeft;
tempY = e.clientY + document.body.scrollTop;
} else {
// for everything else
tempX = e.pageX;
tempY = e.pageY;
}
document.getElementById(elementID).style.top=(tempY-175)+'px';
document.getElementById(elementID).style.left=(tempX-175)+'px';
document.getElementById(elementID).style.visibility = "visible";
}
I am trying to get a pop-up div to position itself relative to the
mouse position when a user clicks on a link. The positioning is
working fine in every browser except IE where it is positioned properly
on the left, but not the top is at the very top of the page instead of
at tempx-175px... Here is my code, can anyone see what I am doing
wrong?
function revealMenu(e, elementID){
// get x,y
if (document.all) {
// for IE
tempX = e.clientX + document.body.scrollLeft;
tempY = e.clientY + document.body.scrollTop;
} else {
// for everything else
tempX = e.pageX;
tempY = e.pageY;
}
document.getElementById(elementID).style.top=(tempY-175)+'px';
document.getElementById(elementID).style.left=(tempX-175)+'px';
document.getElementById(elementID).style.visibility = "visible";
}