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

Attaching Objects to MenuItems

Expand Messages
  • rxhector2k5
    Hey guys, I think this is awesome stuff, but Im a PHP guy and never had any luck with javascript. SO here s what I need to do. I would like to get tool tips
    Message 1 of 3 , Oct 29, 2006
    • 0 Attachment
      Hey guys, I think this is awesome stuff, but Im a PHP guy and never
      had any luck with javascript. SO here's what I need to do. I would
      like to get tool tips to work for my MenuBar MenuItems - and I would
      like to get a panel to open for some menuitems - do i create the
      tooltips and panels and launch them by subscribing the menubaritem to
      a mouseover event?

      I figured out to create menuitems and add them to a menubar
      ex

      aItem = new YAHOO.widget.MenuBarItem("Home" , {url:"<?php echo
      SITE_ADDR; ?>"} );
      oMenuBar.addItem(aItem);

      how do extract menubar items objects if they are created like this

      oMenuBar.addItem(= new YAHOO.widget.MenuBarItem("Home" , {url:"<?php
      echo SITE_ADDR; ?>"} ));

      ummmm...

      thats about it for now.

      thanks
    • rxhector2k5
      OK, this works in Opera - but not FF. I managed to get the tooltip attached to a menubaritem - but it displays in the center of the page. (I m using the
      Message 2 of 3 , Oct 30, 2006
      • 0 Attachment
        OK, this works in Opera - but not FF.
        I managed to get the tooltip attached to a menubaritem - but it
        displays in the center of the page. (I'm using the default css provided)

        var oMenuBar = new YAHOO.widget.MenuBar("mymenubar");

        oMenuBar.addItem(mbHome = new YAHOO.widget.MenuBarItem("HOME" ,
        {url:"./"} ) );
        mbH = YAHOO.util.Dom.get(mbHome)
        YAHOO.util.Dom.get(mbH.element).setAttribute("id" , "mbHome");


        mbHome_tt = new YAHOO.widget.Tooltip("mbHome_tt",
        { context:"mbHome",
        text:"Return to Home Page"} );

        If anybody has any suggestions I would love to hear them.


        --- In ydn-javascript@yahoogroups.com, "rxhector2k5" <rxhector2k5@...>
        wrote:
        >
        > Hey guys, I think this is awesome stuff, but Im a PHP guy and never
        > had any luck with javascript. SO here's what I need to do. I would
        > like to get tool tips to work for my MenuBar MenuItems - and I would
        > like to get a panel to open for some menuitems - do i create the
        > tooltips and panels and launch them by subscribing the menubaritem to
        > a mouseover event?
        >
        > I figured out to create menuitems and add them to a menubar
        > ex
        >
        > aItem = new YAHOO.widget.MenuBarItem("Home" , {url:"<?php echo
        > SITE_ADDR; ?>"} );
        > oMenuBar.addItem(aItem);
        >
        > how do extract menubar items objects if they are created like this
        >
        > oMenuBar.addItem(= new YAHOO.widget.MenuBarItem("Home" , {url:"<?php
        > echo SITE_ADDR; ?>"} ));
        >
        > ummmm...
        >
        > thats about it for now.
        >
        > thanks
        >
      • Todd Kloots
        rxhector2k5 - Yes, you can show/hide a Panel in response to MenuItem events. To launch a YUI Panel, you would subscribe to the desired Custom Event
        Message 3 of 3 , Oct 31, 2006
        • 0 Attachment
          "rxhector2k5" -

          Yes, you can show/hide a Panel in response to MenuItem
          events. To launch a YUI Panel, you would subscribe to
          the desired Custom Event (mouseOver, clickEvent, etc.)
          and then create/show/hide the Panel inside the body of
          your event handlers.

          For Tooltip, you'd set the Tooltip's "context"
          configuration property to the menu item's DOM element.
          Something like this:

          var myTooltip = new YAHOO.widget.Tooltip("myTooltip",
          {
          context:oMenuItem.element,
          text:"You have hovered over myContextEl.",
          showDelay:500 } );

          As you can see in the above element, you can get a
          reference back to the item's DOM via the "element"
          property.

          Lastly, Menu's "addItem" and "insertItem" methods will
          return you a reference to the item that was added.
          You can use that reference to subscribe to the item's
          Custom Events. You can also retrieve a reference to
          an item via the "getItem" or "getItemGroups" methods.

          I hope that helps you with you project.

          - Todd


          --- rxhector2k5 <rxhector2k5@...> wrote:

          > Hey guys, I think this is awesome stuff, but Im a
          > PHP guy and never
          > had any luck with javascript. SO here's what I need
          > to do. I would
          > like to get tool tips to work for my MenuBar
          > MenuItems - and I would
          > like to get a panel to open for some menuitems - do
          > i create the
          > tooltips and panels and launch them by subscribing
          > the menubaritem to
          > a mouseover event?
          >
          > I figured out to create menuitems and add them to a
          > menubar
          > ex
          >
          > aItem = new YAHOO.widget.MenuBarItem("Home" ,
          > {url:"<?php echo
          > SITE_ADDR; ?>"} );
          > oMenuBar.addItem(aItem);
          >
          > how do extract menubar items objects if they are
          > created like this
          >
          > oMenuBar.addItem(= new
          > YAHOO.widget.MenuBarItem("Home" , {url:"<?php
          > echo SITE_ADDR; ?>"} ));
          >
          > ummmm...
          >
          > thats about it for now.
          >
          > thanks
          >
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          > (Yahoo! ID required)
          >
          > mailto:ydn-javascript-fullfeatured@yahoogroups.com
          >
          >
          >
          >
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.