Loading ...
Sorry, an error occurred while loading the content.

MenuBar Menu vs Submenu alignment

Expand Messages
  • sandvich
    By default, a Menubar s menus align their top-left corners to their parents bottom-left corners. The submenus of these menus, however, align their top-left
    Message 1 of 2 , Mar 30, 2008
    • 0 Attachment
      By default, a Menubar's menus align their top-left corners to their parents' bottom-left corners. The submenus of these menus, however, align their top-left corners to their parents' top-right corners.

      This is all fine and dandy, until you get to customizing things. For example, I'm building a RTL site (in Hebrew), and I want to get the exact same behavior from the menubar as normal, just with right and left switched around. So, I want the menus to align their top-right corners with their parents' bottom-right corners, and the submenus to align their top-right corners with their parents' top-left corners.

      The problem is that when I use the submenualignment property, it cascades down to all the menus and submenus as one. So both the top-level menus and the submenus align themselves to the same corners.

      Am I missing something, or is there no way to configure the tr/tl/br/bl values of submenus independently of the top-level menus?
    • Todd Kloots
      sanvich - The easiest way to customize the submenualignment configuration property is to use a render event handler. The render event will fire for each
      Message 2 of 2 , Apr 1, 2008
      • 0 Attachment
        "sanvich" -

        The easiest way to customize the "submenualignment" configuration
        property is to use a render event handler. The render event will fire
        for each menu - the root menu bar and each submenu - and you can use the
        "parent" property to determine the current depth and set the
        "submenualignment" configuration property to the appropriate value for
        that depth.

        oMenuBar.subscribe("render", function () {

        var oParent = this.parent;

        if (oParent) {

        if (oParent instanceof YAHOO.widget.MenuBarItem) {

        // immediate submenu of the menubar

        }
        else {

        // submenus of the immediate submenus of the menubar

        }


        }
        else {

        // the menu bar

        }

        });

        Let me know if that doesn't work or make sense.

        - Todd

        sandvich wrote:
        >
        > By default, a Menubar's menus align their top-left corners to their
        > parents' bottom-left corners. The /submenus/ of these menus, however,
        > align their top-left corners to their parents' top-right corners.
        >
        > This is all fine and dandy, until you get to customizing things. For
        > example, I'm building a RTL site (in Hebrew), and I want to get the
        > exact same behavior from the menubar as normal, just /with right and
        > left switched around/. So, I want the menus to align their top-*right*
        > corners with their parents' bottom-*right* corners, and the submenus
        > to align their top-*right* corners with their parents' top-*left* corners.
        >
        > The problem is that when I use the submenualignment property, it
        > cascades down to all the menus and submenus as one. So both the
        > top-level menus and the submenus align themselves to the same corners.
        >
        > Am I missing something, or is there no way to configure the
        > tr/tl/br/bl values of submenus independ ently of the top-level menus?
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.