Added ability for jBox to align submenu position to right of parent button instead of left
authorDan
Fri, 06 Mar 2009 11:17:47 -0500
changeset 853 21fea79d9de4
parent 852 e1ce6a91469b
child 854 7707f60d4a71
Added ability for jBox to align submenu position to right of parent button instead of left
includes/clientside/static/dropdown.js
--- a/includes/clientside/static/dropdown.js	Mon Mar 02 17:05:27 2009 -0500
+++ b/includes/clientside/static/dropdown.js	Fri Mar 06 11:17:47 2009 -0500
@@ -100,6 +100,13 @@
                 if ( !ul.id )
                   ul.id = 'jBoxmenuobj_' + Math.floor(Math.random() * 10000000);
                 jBoxMenuHeights[ul.id] = parseInt(dim['h']) - 2; // subtract 2px for border width
+                
+                if ( dim['w'] + $dynano(ul).Left() > getWidth() || $dynano(ul).hasClass('jbox_right') )
+                {
+                  $dynano(ul).addClass('jbox_right');
+                  ul.jbox_width = $dynano(ul).Width();
+                }
+                
                 ul.style.display = 'none';
                 domObjChangeOpac(100, ul);
                 
@@ -167,7 +174,14 @@
     var dimh = parseInt(dim['h']);
     var offtop = parseInt(off['top']);
     var top = dimh + offtop;
-    left = off['left'];
+    if ( $dynano(ul).hasClass('jbox_right') )
+    {
+      left = $dynano(obj).Left() + $dynano(obj).Width() - ul.jbox_width; // ( link left + link width ) - ul width
+    }
+    else
+    {
+      left = off['left'];
+    }
     if ( jBox_slide_enable )
     {
       domObjChangeOpac(0, ul);