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

Re: Specifying html element id as parameter to menu.render doesn't work in 2.4.1

Expand Messages
  • ngodilo
    Excellent tip; thank you (although I needed to set position:static, not display:static). This now causes the menu to render in the table cell as desired
    Message 1 of 3 , Dec 31, 2007
    • 0 Attachment
      Excellent tip; thank you (although I needed to set position:static,
      not display:static). This now causes the menu to render in the
      table cell as desired (within the document flow), but it has the
      unhappy side-effect of causing each top-level menu to expand to the
      full width of the table cell; when position:static is removed, the
      width of the menu is limited to the width of the longest menu item,
      which is what I want (sub-menus continue to have only the width of
      the longest menu item). Any suggestion as to how I can force the
      top-level menu to "shrink" to the width of the longest menu item?

      I was also wondering how to eliminate the border around the menu.
      There doesn't seem to be any border attribute for the menu
      object...

      Thanks again in advance.

      --- In ydn-javascript@yahoogroups.com, Adam Moore <adamoore@...>
      wrote:
      >
      > On Fri, Dec 28, 2007 at 09:36:24PM -0000, ngodilo wrote:
      > > I'm very much a newbie both with YUI and with this forum. I'm
      having
      > > trouble with menus in 2.4.1. I used the examples posted
      for "multi-
      > > tiered menu from javascript" using 2.3.1 successfully, creating
      menus
      > > in table cells using the cell ids as parameters to menu.render.
      When
      > > I upgraded to 2.4.1, the code fails. This can easily be
      demonstrated
      > > with the YUI sample code: capture it, redirect YUI references to
      your
      > > own hard drive, and change the fixedcenter attribute of the menu
      to
      > > false. The menu renders at the top left of the viewport instead
      of in
      > > the specified DIV. Same problem if you specify the id of a
      table
      > > cell. It seems to ignore the html element id specified as a
      parameter
      > > to the menu.render method. Thanks in advance...any help would
      be
      > > greatly appreciated!
      >
      > It is rendering in the correct element, but the menu is configured
      to be
      > absolutely positioned. Since the 'rendertarget' element is not
      > positioned, the menu position is set relative to the body. If you
      want
      > the menu to stay in the document flow, set the menu's display
      attribute
      > to 'static'.
      >
      > var oMenu = new YAHOO.widget.Menu("productsandservices", {
      > fixedcenter: true,
      > display: 'static'
      > });
      >
      > If you want the menu to render in that location, but you do not
      want it
      > in the document flow, don't make the above change. Instead, add a
      > position:relative style to the 'rendertarget' element.
      >
      > -Adam
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.