Fixed jBox menus failing to appear when window scrolled down
authorDan
Thu, 31 Jan 2008 22:28:12 -0500
changeset 453 881b77f880fb
parent 452 b6faa6d6ade2
child 455 43b908c9b2e2
Fixed jBox menus failing to appear when window scrolled down
includes/clientside/static/dropdown.js
--- a/includes/clientside/static/dropdown.js	Mon Jan 28 23:07:32 2008 -0500
+++ b/includes/clientside/static/dropdown.js	Thu Jan 31 22:28:12 2008 -0500
@@ -351,12 +351,14 @@
   fieldUL['right'] = off['left'] + dim['w'];
   fieldUL['bottom'] = off['top'] + dim['h'];
   
-  //document.getElementById('debug').innerHTML = '<br /><br /><br /><br /><br />Mouse: x: '+mouseX+', y:' + mouseY + '<br />'; // + document.getElementById('debug').innerHTML;
+  var mouseY_local = mouseY + getScrollOffset();
+  
+  // document.getElementById('debug').innerHTML = '<br />Mouse: x: '+mouseX+', y:' + mouseY + '<br />' + document.getElementById('debug').innerHTML;
   
   if(bias)
   {
     if ( ( mouseX < fieldUL['left'] + 2 || mouseX > fieldUL['right']  - 5 ) ||
-         ( mouseY < fieldUL['top']  - 2 || mouseY > fieldUL['bottom'] - 2 ) )
+         ( mouseY_local < fieldUL['top']  - 2 || mouseY_local > fieldUL['bottom'] - 2 ) )
     {
        return false;
     }
@@ -364,23 +366,11 @@
   else
   {
     if ( ( mouseX < fieldUL['left'] || mouseX > fieldUL['right']  ) ||
-         ( mouseY < fieldUL['top']  || mouseY > fieldUL['bottom'] ) )
+         ( mouseY_local < fieldUL['top']  || mouseY_local > fieldUL['bottom'] ) )
        return false;
   }
      
   return true;
-  
-  /*
-  var tgt = event.target;
-  if ( !tgt )
-    return false;
-  do {
-    if ( tgt == obj )
-      return true;
-    tgt = tgt.parentNode;
-  } while (tgt.tagName.toLowerCase() != 'body' );
-  return false;
-  */
 }
 
 function jBoxGarbageCollection(e)