(function ($) { $(document).ready(function () { $('.toolbar-tray.toolbar-tray-horizontal .menu-item.menu-item--expanded').hover(function () { // At the current depth, we should delete all "hover-intent" classes. // Other wise we get unwanted behaviour where menu items are expanded while already in hovering other ones. $(this).parent().find('li').removeClass('hover-intent'); $(this).addClass('hover-intent'); }, function () { $(this).removeClass('hover-intent'); }); }); })(jQuery);