简体   繁体   中英

How to make menu click disappear on hover

I'm a bit new, so I have a menu that triggers on hover and click. (if you hover the options will show and out will disappear while click will make it stay until you click on something else) but I want to know if its possible to make the click event disappear if I were to hover on another menu because right now if I click on it and hover on something else I'm going to have two menu option list when I want only the hover one to work. I'm sorry if this question was already answered but I can't seem to find it

Thank you very much

If you want both a hover & click event, you may need to set up multiple event listeners:

Simple concept example:

el.on('mouseenter', function(e){ //for hover
  disableClicks();
}

el.on('mouseleave', function(e){ //for hover
  enableClicks();
}

Also, why not just simplify and only have action that is enabled on hover or click? Since the menu will be open already by the time they click...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM