I was surprised to find nothing on this question when searching...please mark as a dupe if this is already answered somewhere:

When using Nice Menus in a responsive theme, we need to be able to kill the nice menu (superfish) functionality completely so we can implement a mobile nav solution. How? I'd assume this involves unsetting the superfish() function in javascsript somehow?

Any help?

Comments

Rob_Feature’s picture

Just a 'bump' on this...any ideas here?

oleksii-s’s picture

Hi Rob!
Did you found any way to destroy a nice menu?

xiukun.zhou’s picture

Status: Active » Fixed

you can try:

function mymodule_library_alter(&$libraries, $module) {
    if($module == 'nice_menus') {
        unset($libraries['superfish']);
   }
}

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

markabur’s picture

I've had this need too, and in the past I just resorted to having a second "non-nice" menu, and using display:none for the original nice-menu on mobile. Finally I spent some time figuring out how to remove the "nice" functionalty and just have a plain menu on mobile. The trick is to use jQuery to remove the nice-menu related classes for small screens when the page is loaded or resized:

(function ($) {
 
$(document).ready(function() {
  toggleNiceMenu();
});
 
$(window).resize(function() {
  toggleNiceMenu();
});

// Add or remove nice-menu functionality
function toggleNiceMenu() {
  if (window.innerWidth < 500) {
    $('#block-nice-menus-1 .content > ul').addClass('mobile-menu').removeClass('nice-menu nice-menu-down nice-menu-main-menu nice-menus-processed sf-js-enabled');
    $('#block-nice-menus-1 .content ul ul').show().css('visibility','visible');
  }
  else {
    $('#block-nice-menus-1 .content > ul').removeClass('mobile-menu').addClass('nice-menu nice-menu-down nice-menu-main-menu nice-menus-processed sf-js-enabled');
    $('#block-nice-menus-1 .content ul ul').hide().css('visibility','hidden');
  }
}

})(jQuery);