[Jifty-commit] r1311 - in jifty/trunk: share/web/static/js

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Jun 17 12:51:04 EDT 2006


Author: trs
Date: Sat Jun 17 12:51:03 2006
New Revision: 1311

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/share/web/static/js/context_menu.js
   jifty/trunk/share/web/static/js/jifty_utils.js

Log:
 r13175 at zot:  tom | 2006-06-17 12:50:50 -0400
 Use relative positioning instead of absolute so that it works it Safari and is faster to show.  IE still needs absolute positioning, so use that if it's IE.


Modified: jifty/trunk/share/web/static/js/context_menu.js
==============================================================================
--- jifty/trunk/share/web/static/js/context_menu.js	(original)
+++ jifty/trunk/share/web/static/js/context_menu.js	Sat Jun 17 12:51:03 2006
@@ -49,14 +49,25 @@
     
         var li = Jifty.ContextMenu.getParentListItem(ul);
 
-        if ( ul.style.position == "" ) {
-            var x = Jifty.Utils.findPosX( li );
-            var y = Jifty.Utils.findPosY( li ) + li.offsetHeight;
-
-            ul.style.position = "absolute";
-            ul.style.left     = x + "px";
-            ul.style.top      = y + "px";
-            ul.style.width    = li.offsetWidth * 2 + "px";
+        ul.style.position = "absolute";
+        ul.style.width    = li.offsetWidth * 2 + "px";
+        
+        /* Use position: relative based positioning for every browser
+           but IE, which needs to use absolute positioning */
+        if ( Jifty.Utils.isMSIE ) {
+            if ( ul.style.position == "" ) {
+                alert("This is IE!");
+                var x = Jifty.Utils.findPosX( li );
+                var y = Jifty.Utils.findPosY( li ) + li.offsetHeight;
+                
+                ul.style.left = x + "px";
+                ul.style.top  = y + "px";
+            }
+        }
+        else {
+            ul.style.left     = "-1px";
+            ul.style.top      = li.offsetHeight - 2 + "px";
+            li.style.position = "relative";
         }
 
         Element.removeClassName(li, "closed");

Modified: jifty/trunk/share/web/static/js/jifty_utils.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty_utils.js	(original)
+++ jifty/trunk/share/web/static/js/jifty_utils.js	Sat Jun 17 12:51:03 2006
@@ -31,6 +31,15 @@
         else if (obj.y)
             curtop += obj.y;
         return curtop;
-    }
+    },
+
+    isMSIE: false
 };
 
+/* This sets Jifty.Utils.isMSIE to true in IE
+    @cc_on@
+    if ( @_win32 )
+        Jifty.Utils.isMSIE = true;
+    @end@
+*/
+


More information about the Jifty-commit mailing list