Skip to content

Instantly share code, notes, and snippets.

@vielhuber
Last active September 22, 2017 23:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vielhuber/8de11ad8790b8eb11168 to your computer and use it in GitHub Desktop.
Save vielhuber/8de11ad8790b8eb11168 to your computer and use it in GitHub Desktop.
change hover to click in Advanced Menu #shopware
$(document).ready(function() {
$('.navigation-main .navigation--entry').off();
$('.navigation-main .navigation--entry').click(function() {
if( $(this).hasClass('is--hovered') ) {
$(this).removeClass('is--hovered');
$('.advanced-menu .menu--is-active').removeClass('menu--is-active');
return false;
}
else {
$(this).siblings('.is--hovered').removeClass('is--hovered');
$(this).addClass('is--hovered');
$('.advanced-menu .menu--is-active').removeClass('menu--is-active');
if( $('.advanced-menu .menu--container:nth-child('+$(this).prevAll('li').length+') .has--content').length > 0 ) {
$('.advanced-menu .menu--container:nth-child('+$(this).prevAll('li').length+')').addClass('menu--is-active');
$('.advanced-menu').show();
return false;
}
}
});
$('.navigation-main').on('mouseleave',function() {
$('.advanced-menu .menu--is-active').removeClass('menu--is-active');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment