r3458 committed - menu: positioning for drilldown menu, still faaar from complete

r3458 committed - menu: positioning for drilldown menu, still faaar from complete


Revision: 3458
Author: joern.zaefferer
Date: Sun Nov 15 22:12:14 2009
Log: menu: positioning for drilldown menu, still faaar from complete
http://code.google.com/p/jquery-ui/source/detail?r=3458
Modified:
/branches/dev/tests/visual/menu/drilldown.html
=======================================
--- /branches/dev/tests/visual/menu/drilldown.html    Fri Nov 13 08:55:54 2009
+++ /branches/dev/tests/visual/menu/drilldown.html    Sun Nov 15 22:12:14 2009
@@ -21,26 +21,27 @@
                this.element.find("ul").menu({
                    selected: function(event, ui) {
-                        self.element.find("h3").text(ui.item.text());
-                        self.options.selected.apply(this, arguments);
-                    },
-                    focus: function(event, ui) {
+                        var nested = $(">ul", ui.item);
+                        if (!nested.length) {
+                            self.element.find("h3").text(ui.item.text());
+                            self.options.selected.apply(this, arguments);
+                            return;
+                        }
                        self.active = ui.item.parent();
                        // put a previous submenu back into its place and hide it
                        self.hideDown();
-                        var nested = $(">ul", ui.item);
                        if (nested.length) {
                            // append to body in order to display the submenu above the parent
menu, instead of inside of it
                            nested.appendTo(document.body).menu("deactivate").show().position({
                                my: "left top",
-                                at: "right top",
-                                of: ui.item
+                                at: "left top",
+                                of: self.element.children("ul:first")
                            // store the current submenu
                            }).data("menuparent", ui.item);
                            self.active.data("submenu", nested);
                        }
-                    }
+                    },
                })
            },
@@ -166,7 +167,7 @@
    </script>
    <style>
        body { font-size:62.5%; }
-        #drilldown { width: 200px; }
+        .ui-menu { width: 200px; height: 170px; }
        .ui-menu .ui-icon { float: right; }
    </style>
</head>