0

I have a drupal site in development and have installed a module (we_megamenu) which as standard created a hamburger menu (when below 991px) which when clicked opens an off canvas menu.

Now the design requirement is that the menu not be off canvas so I need to override/cancel the click and/or touch event(s) and then override the CSS to make it a menu which appear under the site header.

I can't modify the modules JS directly as it is a contributed codebase, so I need to somehow ensure the event simply doesn't fire and then uses mine instead.

I've managed to stop the scripts in the debugger using Chromes dev tools as explained here: How do I view events fired on an element in Chrome DevTools?

Problem is the code running is buried in the js.min source and I cannot find the module's calling function, not that its any use to me as I cannot modify their code.

Is there a way to remove all functions from a given element? Cancelling all events would be easier that over riding if possible.

Regards and thanks John

Nick Parsons
  • 45,728
  • 6
  • 46
  • 64
John Cogan
  • 1,034
  • 4
  • 16
  • 39

1 Answers1

0

Using regular jQuery you can use .off() to remove event listeners and then attach your own, but since you are using drupal, you might want to look into their native mechanisms to do that: Drupal behaviours.

If it helps, you can find the raw js for the module here.

msg
  • 7,863
  • 3
  • 14
  • 33