Comments (15)
I've had the same issue, and wanted to share the complete solution:
exitMenu: function (row) {
return true;
},
This should be added in the docs, so other people can easily use this in their projects.
from jquery-menu-aim.
This bug is a general bug and not related to bottom setting or Shopware.
The bug also exists in the offical demo under:
https://rawgit.com/kamens/jQuery-menu-aim/master/example/example.html
Steps to reproduce:
- Open https://rawgit.com/kamens/jQuery-menu-aim/master/example/example.html
- Click on "Explode the monkeys" to open sub menu
- Mouse over over any of the menu items, let's say "Patas"
- Move your mouse out to the left and click anywhere on the page so the dropdown will be closed
- Click again on "Explode the Monkeys" to open sub menu
- Mouse over over the "Patas" again
Expected result
- Drop-Down for "Patas" should open
Current result
- Drop-Down does not open
from jquery-menu-aim.
The mouseleaveMenu function only triggers the deactivate function, if the exitMenu option is supplied and returns true:
`
$('.module-nav .module-nav__lvl1').each(function () {
var
$menu.menuAim({
activate: activateSubmenu,
exitMenu: deactivateSubmenu,
submenuDirection: "below"
});
});
function activateSubmenu(row) {
var
$row.addClass('-hover').siblings().removeClass('-hover');
}
function deactivateSubmenu(row) {
var
$row.find('> .module-nav__item').removeClass('-hover');
return true;
}
`
from jquery-menu-aim.
@rossmedia I think this is not the intended behaviour, see this post: #50 (comment)
Because of this, I think it is better to make this option as an "opt-in"-option, rather than the default.
What do you think?
from jquery-menu-aim.
@MBWebTechMariusz Oh yes sorry now i understand the problem. When i implement your solution the benefit of this plugin (work like amazons menu and don't close when you) is not working anymore. :(
from jquery-menu-aim.
Problem exists because the activate function gets executed but the deactivate function doesn't get executed
from jquery-menu-aim.
Quite annoying indeed. I've just found out about this bug, which makes the plugin not a good fit for production.
from jquery-menu-aim.
I've just found a workaround. It isn't ideal but it works:
/**
* @function `init`
*
* Initializes the desktop navigation behavior.
*
* 1. Hide the panel on exit.
*/
function init() {
$navBar.menuAim({
rowSelector: navGroup,
activationDelay: 0,
activate: function(el) {
showNavPanel(el);
},
deactivate: function(el) {
hideNavPanel(el);
},
exit: function(el) {
hideNavPanel(el); /* [1] */
},
submenuDirection: 'above'
});
is_desktop_nav = true;
enableClickOnPanelLabel();
}
/**
* When leaving the panel, unbind the mouseenter event
* and initialize menuAim again. Not ideal as it doesn't destroy
* the first instance.
*/
$navPanel.on('mouseleave', function(e) {
e.preventDefault();
$navGroup.unbind('mouseenter');
init();
});
So basically: hide the nav panel on exit, bind a mouseleave
event to all panels and initialize menuAim again.
from jquery-menu-aim.
I tried your workaround and it does the job just fine. You basically just double force it. In my own workaround I made it exactly like that, even though it wasn't as elegant as yours.
Hopefully someone will solve this issue
from jquery-menu-aim.
same issue
from jquery-menu-aim.
@heun01 is that how you suggest to fix it? 🤔
from jquery-menu-aim.
Yeah works for me.
from jquery-menu-aim.
I had the same issue and I had overlooked this comment on exitMenu in the example config
if you have a exitMenu option, it needs to return true
// Function to call when mouse exits the entire menu. If this returns
// true, the current row's deactivation event and callback function
// will be fired. Otherwise, if this isn't supplied or it returns
// false, the currently activated row will stay activated when the
// mouse leaves the menu entirely.
exitMenu: function (row) {
return true;
},
from jquery-menu-aim.
@MBWebTechMariusz Thanks! We had no exitMenu callback implemented so we just added a function like you did and with that it works fine. I think there should be some workaround implemented which fixes that bug and let exitMenu return true by default, even if no callback is implemented.
from jquery-menu-aim.
Yeah, this is a drawback. But I think this is intended, so we need to try it with just
exitMenu: function (row) {
return true;
},
from jquery-menu-aim.
Related Issues (20)
- Nested Menu with Menu-aim HOT 4
- if Submenu is active
- Bootstrap columns / rows HOT 1
- Menu aim can not show sub menu on Firefox HOT 2
- Publish to NPM? HOT 1
- Does a non-jquery version exist? HOT 2
- Delayed submenu on hover HOT 2
- Compatibility issue with displaing menu with jquery.stickyNavbar
- jQuery-menu-aim with Jquery Vertical UI tabs HOT 1
- Responsive dropdowns
- There is no git tags on GitHub repository
- how to keep the container fixed?
- Describe the tolerance option in the documentation
- submenuSelector not working
- Example for horizontal menus? HOT 2
- Prevent event bubbling ?
- Navigating through keyboard
- Wordpress plugin?
- Consider rewriting this plugin as a hook/component for react?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-menu-aim.