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

Re: possible to hide the menu if click on it?

Expand Messages
  • yoonfui83
    hi, i had try a new example here. below is the code: =====================================================
    Message 1 of 5 , May 9, 2007
    • 0 Attachment
      hi,

      i had try a new example here. below is the code:

      =====================================================
      ===========================================================
      =================================================================

      <script type="text/javascript">
      var oMenu = '';
      YAHOO.example.onDOMReady = function(p_sType) {
      oMenu = new YAHOO.widget.Menu("basicmenu", {
      fixedcenter: true });
      oMenu.addItems([
      { text:"Yahoo! Mail" },
      { text:"Yahoo! Notepad", url:"javascript:abc
      ()" }
      ]);

      oMenu.render(document.body);
      oMenu.showEvent.subscribe(function() {
      this.focus();
      });

      // YAHOO.util.Event.addListener("menutoggle", "click",
      oMenu.show, null, oMenu);
      };

      YAHOO.util.Event.onDOMReady(YAHOO.example.onDOMReady);

      function press() {
      //alert(oMenu);
      oMenu.show();
      }

      function abc() {
      alert("hi");
      }
      </script>
      <body>
      <button id="menutoggle" onclick="press()">Show Menu</button>
      </body>


      =========================================================
      ==============================================
      =================================


      even i comment off the code u mention and i use "onclick" event but
      still not work. the menu still there after i click on it.




      --- In ydn-javascript@yahoogroups.com, Todd Kloots <kloots@...> wrote:
      >
      > "yoonfui83" -
      >
      > The problem is you seem to have mistakenly copied in code from one
      of
      > the menu examples that keeps the menu visible when clicked. Remove
      this
      > line from your code:
      >
      > YAHOO.util.Event.addListener("menutoggle", "click", oMenu.show,
      null, oMenu);
      >
      > - Todd
      >
      > yoonfui83 wrote:
      > > hi,
      > >
      > > currently im using YUI_2.2.2 version. Sorry for the YUI Menu
      > > version. im not sure where to find that. Even the sample still
      remain
      > > the menu when you click on it. Below is my code:
      > >
      > >
      > >
      > >
      > >
      ====================================================================
      > >
      ====================================================================
      > >
      > > function myCode(oMenu) {
      > > if (req.readyState == 4) {
      > > aItems = eval('(' + req.responseText + ')');
      > >
      > > var oMenu = new YAHOO.widget.Menu(
      > >
      > > "productsandservices",
      > > {
      > >
      xy:
      > > [37,173],
      > >
      > > hidedelay:250,
      > >
      > > effect:{
      > >
      > > effect:YAHOO.widget.ContainerEffect.FADE,
      > >

      > > duration:0.35
      > >
      > > }
      > > }
      > > );
      > >
      > > oMenu.addItems(aItems);
      > > oMenu.render(document.body);
      > > oMenu.showEvent.subscribe(function() {
      > > this.focus();
      > > });
      > > YAHOO.util.Event.addListener("menutoggle", "click",
      > > oMenu.show, null, oMenu);
      > > }
      > > }
      > >
      > > YAHOO.example.onDOMReady = function(p_sType) {
      > > req = GetXmlHttpObject()
      > > if (req == null) {
      > > alert ("Your browser does not support AJAX!");
      > > return;
      > > }
      > >
      > > req.onreadystatechange = myCode; // the handler
      > > req.open("GET", "gv/menu.json", true);
      > > req.send(null);
      > > };
      > >
      > >
      ====================================================================
      > >
      ====================================================================
      > >
      > >
      > >
      > >
      > > --- In ydn-javascript@yahoogroups.com, Todd Kloots <kloots@>
      wrote:
      > >
      > >> yoonfui83 -
      > >>
      > >> As of version 0.11.3 a YUI menu will hide automatically when you
      > >>
      > > click
      > >
      > >> on it. Are you using a version prior to 0.11.3? If not, can
      you
      > >>
      > > please
      > >
      > >> post a link to your example?
      > >>
      > >> - Todd
      > >>
      > >> yoonfui83 wrote:
      > >>
      > >>> hi,
      > >>>
      > >>> i noticed that the menu content wouldn't hide itself when you
      > >>>
      > > click on
      > >
      > >>> it.
      > >>>
      > >>> is there any properties to configure it ? Or it is just like
      > >>>
      > > that ?
      > >
      > >>> thanks.
      > >>>
      > >>>
      > >>>
      > >>>
      > >>>
      > >>>
      > >>> Yahoo! Groups Links
      > >>>
      > >>>
      > >>>
      > >>>
      > >>>
      > >
      > >
      > >
      > >
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.