[ 7 posts ]

Marc

YUI Contributor

  • Offline
  • Profile

Having Menu open onClick in stead of onMouseover

Post Posted: Sun Dec 06, 2009 11:05 am
+0-
Hi,

I want to open and close a menu with a click in stead of a mouseover. How can I do this? basically, I want to unregister the mouseover event listener from the menu object.

I realize the button class has this behaviour, but I avoided it, because it is based on a select in stead of regular ul/li markup which seems more search engine friendly to me.

Kind regards,

Marc

Donald Fincher

YUI Contributor

  • Username: Floydian
  • Joined: Sat Jan 24, 2009 2:27 pm
  • Posts: 233
  • Location: Ohio
  • GitHub: floydian
  • Gists: floydian
  • IRC: floydian2
  • YUI Developer
  • Offline
  • Profile

Re: Having Menu open onClick in stead of onMouseover

Post Posted: Sun Dec 06, 2009 4:45 pm
+1-
Hello Marc,

You're looking for this: autosubmenudisplay
http://developer.yahoo.com/yui/docs/YAH ... enudisplay

It's a config setting for the menu.

Cheers

Todd Kloots

YUI Contributor

  • Username: kloots
  • Joined: Fri Nov 28, 2008 4:09 pm
  • Posts: 41
  • Twitter: todd
  • GitHub: kloots
  • Gists: kloots
  • YUI Developer
  • Offline
  • Profile

Re: Having Menu open onClick in stead of onMouseover

Post Posted: Mon Dec 07, 2009 11:40 am
+0-
Marc -

You don't have to use a <select> element in order to get the behavior you want using Button. Here are two examples, the second of which uses a list for the menu:

Completely from script:
http://yuiblog.com/sandbox/yui/v280/exa ... ple01.html

From existing markup:
http://yuiblog.com/sandbox/yui/v280/exa ... ple03.html

- Todd

Marc

YUI Contributor

  • Offline
  • Profile
Tags:

Re: Having Menu open onClick in stead of onMouseover

Post Posted: Mon Dec 07, 2009 2:14 pm
+0-
Didn't know that. Thanks for this. I'll look into replacing the menu with a button, at least it's a smaller library.

Cheers,

Marc

Cameron Usman

  • Username: cusman
  • Joined: Mon Aug 08, 2011 5:56 pm
  • Posts: 2
  • Offline
  • Profile

Re: Having Menu open onClick in stead of onMouseover

Post Posted: Mon Aug 08, 2011 6:17 pm
+0-
I played around with the different configuration options available and for me the best option to use ended up being the following:

autosubmenudisplay: true
, showdelay: 0
, hidedelay: 750
, lazyload: true

showdelay specifically with default of 250 is too slow and that is when users are observed fumbling around with the animated pull-downs, clicking to "stop" them.

Setting autosubmenudisplay to false also works, but then the user has to toggle the hovering on/off which confused a different set of users.

Cameron Usman

  • Username: cusman
  • Joined: Mon Aug 08, 2011 5:56 pm
  • Posts: 2
  • Offline
  • Profile

Re: Having Menu open onClick in stead of onMouseover

Post Posted: Mon Aug 08, 2011 6:27 pm
+0-
I also observed users and myself to have natural instinct to click to accelerate the opening and instead causing the submenu to close.

autosubmenudisplay can be changed from default of true to false and then it only opens submenus on click-toggle. This gets reset when you hover away from the menu for long enough (or click somewhere else). I felt it is better to keep it on true.

showdelay has default of 250 and really the cause of the issue. The setting can be changed to 0 which makes the problem go away.

hidedelay I leave at default of 750 which may be too long for some users but it would be too short for others if I reduce it.

lazyload seems to be a necessary setting to leave on default of true. Changing this to false makes the menu's work very poorly.

Brian White

  • Username: beedub
  • Joined: Wed Mar 28, 2012 8:40 am
  • Posts: 7
  • Offline
  • Profile
Tags:

Re: Having Menu open onClick in stead of onMouseover

Post Posted: Sat Apr 28, 2012 3:58 pm
+0-
Why can't I just set autoSubmenuDisplay:false and show a menu with a call to

Y.one('#menu').on('click',function(hit){hit.currentTarget.show();} // does not work though it seems like it should

I don't want to mouseover to show. I want to click on it. Am I just missing the easy way to do this?
  [ 7 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum