[Wylug-help] Firefox absolute positioning stopped working

Gary Stainburn gary.stainburn at ringways.co.uk
Mon Nov 11 16:21:20 UTC 2013


Hi folks,

I use popup div's in my web pages - div's that are initally display:none but 
then on an event have their absolute size and position changed.

This method worked fine until recently (not sure how recent, but it's been 
broken for a couple of weeks at least). It still works in I.E., Chrome and 
Firefox on Win7 PC's.

However, on my Fedora workstations, the div is no longer appearing in the 
right place (top left corner appearing where mouse pointer is). It now 
appears on the very top left corner of the window.

The only thing I can think of is that my Fedora boxes are regularly updated 
while my Windows PC's only get software updates occassionally. This would 
point to the problem being a recent firefox update.

Can anyone help as Google is only showing me old items.

Gary

HTML

<body width=100% height=100% bgcolor="white" >
<div id='hoverpopup' style='visibility:hidden; position: absolute; 
width:200px; border:1px solid #000000; background-color:#ffffff;' 
onMouseOver='Keeppopup(this);' onMouseOut='Hidepopup();'></div>

.............
<table id=vista width=100% onMouseOver="vistaTableMouseOver(event);" 
onMouseOut="vistaTableMouseOut(event);" onclick="vistaTableClick(event);">

JAVASCRIPT (called from onMouseOver
function vistaTableMouseOver(e) {
  if (!e)
    return;
  var t=e;
  if (!t.id) { // event mode
    if (e && ((t = e.target) || (t = e.srcElement))) {
    while (! t.id && t.parentNode && t.nodeName != 'TR')
      t=t.parentNode;
    }
  }
  if (!t.id) 
    return;
  var windowLowerX=window.innerWidth;
  var windowLowerY=window.innerHeight;
  if (e.clientX) { // store target X/Y
    var vistaDivX=e.clientX;  // location of mouse click
    var vistaDivY=e.clientY;
  } else {
    var vistaDivX=findX(t); // location of TD
    var vistaDivY=findY(t);
  }

  var vistaKey=t.id;
  var hp = document.getElementById("hoverpopup");
  hp.style.width='200px';
  hp.innerHTML='Please wait....';
  var xOffset=vistaDivX+20;
  var yOffset=vistaDivY+10;
  var divLowerX=vistaDivX+200;
  var divLowerY=vistaDivY+hp.clientHeight;
  // ensure the div is visible, i.e. not off the right / bottom
  if (divLowerY > windowLowerY) {
    yOffset=window.innerHeight-(hp.clientHeight+10);
  }
  if (divLowerX > windowLowerX) {
    xOffset=window.innerWidth-(hp.clientWidth+10);
  }

}



-- 
Gary Stainburn
Group I.T. Manager
Ringways Garages
http://www.ringways.co.uk 



More information about the Wylug-help mailing list