[dev] Patch for ie6 scrollbar bug

Jason Rust jrust at rustyparts.com
Fri May 16 14:45:02 PDT 2003


The attached patch fixes a bug where the menu bar in the left and right
frames have a gap between them.  The gap is due to a margin-right
property that is added because of ie6's scrollbar_in_way bug.  This
patch for the left hand menu uses javascript to determine if the
scrollbar is present and if not it takes off the extra margin.  Tested
it in ie6 with a menu that resulted in a scrollbar and one that did not.

-Jason

-- 
http://www.rustyparts.com/
puttin' some rust into it!
-------------- next part --------------
Index: menu.php
===================================================================
RCS file: /repository/horde/menu.php,v
retrieving revision 2.38
diff -u -r2.38 menu.php
--- menu.php	18 Mar 2003 16:33:44 -0000	2.38
+++ menu.php	16 May 2003 21:25:00 -0000
@@ -70,6 +70,26 @@
 $last_group = -1;  // To track groups of menus to make <div>s.
 $last_parent = 0;  // Track the last parent we used.
 
+require_once HORDE_BASE . '/lib/Browser.php';
+$browser = &Browser::singleton();
+if ($browser->hasQuirk('scrollbar_in_way')) {
+    $menutext .= '
+    <script language="JavaScript" type="text/javascript">
+    // Correct for frame scrollbar in IE by determining if a scrollbar is present,
+    // and if not readjusting the marginRight property to 0
+    // See http://www.xs4all.nl/~ppk/js/doctypes.html for why this works
+    function correctWidthForScrollbar()
+    {
+        if (document.documentElement.clientHeight == document.documentElement.offsetHeight) {
+            // no scrollbar present, take away extra margin
+            document.body.style.marginRight = 0; 
+        }
+    }
+
+    window.onload = correctWidthForScrollbar; 
+    </script>';
+}
+
 foreach ($registry->applications as $app => $params) {
     $params['name'] = gettext($params['name']);
     if ($params['status'] == 'active' || $params['status'] == 'heading') {


More information about the dev mailing list